I agree that failing fast is a good principle. My initial point led the other
way though, i.e. any unmatched formal arguments without default values should
be handled in one of two ways:
1. Fail the function call. This is what most non-functional languages do e.g.
Python
>>> def f(x,y,z): x
...
On Wed, Jul 17, 2013 at 10:20 AM, Ben Bolker wrote:
> Brian Rowe muxspace.com> writes:
>
> >
> > Thanks for the lead. Given the example in ?missing though,
> > wouldn't it be safer to explicitly define a
> > default value of NULL:
> >
> > myplot <- function(x, y=NULL) {
> > if(is.null(y)) {
>
Brian Rowe muxspace.com> writes:
>
> Thanks for the lead. Given the example in ?missing though,
> wouldn't it be safer to explicitly define a
> default value of NULL:
>
> myplot <- function(x, y=NULL) {
> if(is.null(y)) {
> y <- x
> x <- 1:length(y)
> }
> plot(x, y)
> }
>
[sni
Thanks for the lead. Given the example in ?missing though, wouldn't it be safer
to explicitly define a default value of NULL:
myplot <- function(x, y=NULL) {
if(is.null(y)) {
y <- x
x <- 1:length(y)
}
plot(x, y)
}
On Jul 17, 2013, at 11:05 AM, "R. Michael Weylandt"
wrote:
> On
Hello,
Section 4.3.2 of the R language definition [1] states that argument matching to
formal arguments is a 3-pass process to match arguments to a function. An error
is generated if any (supplied) arguments are left unmatched. Interestingly the
opposite is not true as any unmatched formals doe
On Wed, Jul 17, 2013 at 9:58 AM, Brian Rowe wrote:
> Hello,
>
> Section 4.3.2 of the R language definition [1] states that argument matching
> to formal arguments is a 3-pass process to match arguments to a function. An
> error is generated if any (supplied) arguments are left unmatched.
> Inte