What is "..." when it's empty? -- differences to S

Prof Brian D Ripley ripley@stats.ox.ac.uk
Sun, 27 Jun 1999 08:39:51 +0100 (BST)


On Sat, 26 Jun 1999, Martin Maechler wrote:

> i)       (function(x, ...) length(...))(1)
> 
> gives 0 in S (plus 3.4) and an error in R.
> It also gives an error in Splus 5.0r3.
> So we could well remain as we are... however
> 
> ii)	(function(x, ...) length(...))(1,2)
> 
> gives 1  in all dialects of S that I have available.
> So by my `continuation logic', I'd argue that  "i)" above should give 0
> (and R and S-plus 5.0r3 behave inconsistently.

Try 

iii)   (function(x, ...) length(...))(1,2,3)

to see that the continuation logic is false.

I think function(x, ...) length(list(...)) is what one wants here, and they 
(R, 3.4, 5.1) are all consistent on that.  (I see that is what you put in
C.)

> Do we yet have any documentation on "..." ??
> 
> In both Splus 3.4 and 5.0r3,
>    (function(x, ...) mode(...))(1)	returns "missing"
> whereas R gives an interesting error:
>     R> trace(mode)
>     R> (function(x, ...) mode(...))(1)
>     trace: mode(...)
>     Error: Argument "x" is missing, with no default
> 
> ---
> What is desired for R?

I would leave these: none of them seem sensible uses of ... to me.

BTW, NEWS says

    o   C() didn't works (again?) for a single argument

which apart from grammar seems not entirely precise. It looks to me that
it failed if how.many _and_ ... were missing, and that was broken only
once, in 

revision 1.2.2.1
date: 1999/05/05 01:25:24;  author: ripley;  state: Exp;  lines: +4 -3
Add ... args to pass to contr.treatment etc

Also, I do not really like `didn't work': can we try to distinguish
between `failed' (gave an error) and `gave incorrect results'?  
Reason: the second is much more serious.

Brian

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._