[Rd] paste(character(0), collapse="", recycle0=FALSE) should be ""

Hervé Pagès hp@ge@ @end|ng |rom |redhutch@org
Tue May 26 21:38:13 CEST 2020

Hi Martin,

On 5/26/20 06:24, Martin Maechler wrote:
> What about remaining back-compatible, not only to R 3.y.z with
> default recycle0=FALSE, but also to R 4.0.0 with recycle0=TRUE

What back-compatibility with R 4.0.0 are we talking about? The 
'recycle0' arg was added **after** the R 4.0.0 release and has never 
been part of an official release yet. This is the time to fix it.

> *and* add a new option for the Suharto-Bill-Hervé-Gabe behavior,
> e.g., recycle0="sep.only" or just  recycle0="sep" ?


> As (for back-compatibility reasons) you have to specify
> 'recycle0 = ..'  anyway, you would get what makes most sense to
> you by using such a third option.
> ? (WDYT ?)

Don't bother. I'd rather use

   paste(paste(x, y, z, sep="#", recycle0=TRUE), collapse=",")

i.e. explicitly break down the 2 operations (sep and collapse). Might be 
slightly less efficient but I find it way more readable than

   paste(x, y, z, sep="#", collapse=",", recycle0="sep.only")

BTW I appreciate you trying to accomodate everybody's taste. That 
doesn't sound like an easy task ;-)

I'll just reiterate my earlier comment that controlling the collapse 
operation via an argument named 'recycle0' doesn't make sense (collapse 
involves NO recycling). So I don't know if the current 'recyle0=TRUE' 
behavior is "the correct one" but at the very least the name of the 
argument is a misnomer and misleading.

More generally speaking using the same argument to control 2 distinct 
operations is not good API design. A better design is to use 2 
arguments. Then the 2 arguments can generally be made orthogonal (like 
in this case) i.e. all possible combinations are valid (4 combinations 
in this case).


> Martin
>      > Switching to scheme (3) or to a new custom scheme
>      > would be a completely different proposal.
>      >>
>      >> At least I'm consistent right?
>      > Yes :-)
>      > Anyway discussing recycling schemes is interesting but not directly
>      > related with what the OP brought up (behavior of the 'collapse' operation).
>      > Cheers,
>      > H.
>      >>
>      >> ~G

Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages using fredhutch.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

More information about the R-devel mailing list