[Rd] Argument matching for primitives

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Sun, 14 Mar 2010 14:27:10 +0000 (GMT)


Recent changes to R-devel has altered the way arguments are matched in most primitives to be identical to the argument matching in interpreted functions. So if argument names are supplied they are checked, surplus arguments are errors, and it is possible to use
(perverse) constructions like substitute(e=list(x=1), y ~ x).

There are a few deliberate exceptions: functions like

call switch .C .Call

need to always match the first argument avoiding partial matching to named arguments in '...', and do use positional matching. And the perverse

x <- 1
x <- `length<-`(value=3, x=x)

is now an error: two-argument replacement functions still need 'value' supplied as the second argument but the names are checked.

This has caught long-term errors in several packages, e.g. people writing proc.time(<expression>) where system.time() was more plausible, misusing nargs() (if you want the number of args in ..., use length(list(...)), not nargs(...)), using on.exit(par=opar) not on.exit(par(opar)), and so on.

Specifically CRAN packages NMF, RobAStBase, TTR, aroma.light, catspec, gvlma, mvbutils, orloca, orloca.es, sm and staRt now fail in R-devel
(and also some that use them).

-- 
Brian D. Ripley,                  ripley_at_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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sun 14 Mar 2010 - 14:29:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 14 Mar 2010 - 23:31:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive