On Mon, Feb 18, 2013 at 10:35 AM, peter dalgaard <pda...@gmail.com> wrote: > > On Feb 18, 2013, at 17:04 , Hadley Wickham wrote: > >> quote(expr =) returning missing seems like the right thing to me, >> quote() throwing an error does not, because it violates the usual >> semantics where f(x = ) is equivalent to f(). > > Except that it isn't: > >> (function(...)nargs())() > [1] 0 >> (function(...)nargs())(x=) > [1] 1
But hardly any functions use nargs: > find_funs("package:base", fun_calls, fixed("nargs")) Using environment package:base [1] "-.Date" "-.POSIXt" "[.data.frame" [4] "[[.data.frame" "[[<-.data.frame" "[[<-.numeric_version" [7] "[<-.data.frame" "+.Date" "+.POSIXt" [10] "diag" "message" "Ops.data.frame" [13] "Ops.Date" "Ops.difftime" "Ops.numeric_version" [16] "Ops.POSIXt" "seq.default" "stop" [19] "system.file" "trace" "warning" > find_funs("package:stats", fun_calls, fixed("nargs")) Using environment package:stats [1] "model.frame.default" The majority is used to switch between cases like -x vs x - y or to detect extra arguments if something weird is being done with ... So I think it's reasonable to expect that f() and f(x = ) do the same thing. Hadley -- Chief Scientist, RStudio http://had.co.nz/ ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel