Skip to content
Prev 139408 / 398503 Next

Use of ellipses ... in argument list of optim(), integrate(), etc.

Ravi Varadhan wrote:
Putting optim() arguments after the ... disallows the use of abbreviated 
actual arguments for optim().  This is generally a good thing, because 
prior to this change, it was impossible to supply, via the '...' arguments 
of optim(), an argument to fn() whose name was a prefix of one of the 
arguments of optim().  E.g., if your function had a argument named 'm', you 
could not previously supply it via the '...' argument of optim(), because 
if you did something like optim(x, fun, m=240), intending 'm' to be passed 
to 'fun', the 'm' would instead match the 'method' argument of optim().

The cons of the new argument structure are that abbreviations for names of 
arguments of optim() can't be used (a minor and debatable con), and that 
previous code that used abbreviations might break, but it will likely break 
quickly and noisily, so it's not too bad (the only case where it wouldn't 
break is when fn has a '...' argument itself, and it ignores unrecognized 
components, or where the are other argument name collisions).

-- Tony Plate