Skip to content

Changing "..." inside a function: impossible? desirable?

1 message · Tony Plate

#
Another way of enabling more vesatile dot-args would be to allow an 
ordinary list to be used as "dotargs", e.g., the following three would be 
equivalent (except for issues around lazy evaluation):

# V1: current simple passing of dotargs
function(x, ...) {
    f(x, ...)
}

# V2: allow manipulation of dotargs using current language features, but 
syntax is ugly
function(x, ...) {
     dotargs <- list(...)
     do.call("f", c(list(x), dotargs))
}

# V3: proposed syntax for passing dotargs
function(x, ...) {
      dotargs <- list(...)
      f(x, ...=dotargs)  # a new syntax
}

This syntax in #3 would allow manipulation of dot-arguments, with a sweeter 
syntax for passing them than do.call() provides.

Where this might not fit neatly with the current semantics of the S 
language is that the "dotargs <- list(...)" would trigger evaluation of 
actual arguments.

-- Tony Plate
At Tuesday 03:28 PM 12/17/2002 -0500, Warnes, Gregory R wrote: