[Rd] Mishandling missing "..." (PR#1247)

brahm@alum.mit.edu brahm@alum.mit.edu
Mon, 7 Jan 2002 16:52:57 +0100 (MET)


R> myfun <- function(x, ...) {x[...] <- 0; x}
R> myfun(3)
   Error in myfun(3) : SubAssignArgs: invalid number of arguments

It fails because no ... was passed.  The workaround (and desired behavior) is:
R> myfun <- function(x, ...) {if (missing(...)) x[] <- 0 else x[...] <- 0; x}
R> myfun(3)
   [1] 0

Deja vu?  This is the one piece of my PR#1110 (Oct 3, 2001) that I think may be
a genuine bug (though even that is debatable), and I would like to override
PR#1110 with this report.  This behavior still occurs in 1.4.0.

-- 
                              -- David Brahm (brahm@alum.mit.edu)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._