Currently, if one wants to test if an argument to an outer function is
missing from within an inner function, this works:
> g5 <- function(a) {
+   inner <- function(a) {
+     if (missing(a))
+       "outer arg is missing"
+     else
+       "found outer arg!"
+   }
+   inner(a)
+ }
> g5(3)
[1] "found outer arg!"
> g5()
[1] "outer arg is missing"

While if inner is defined as function() (without arguments) one gets
an error: 'missing' can only be used for arguments.

However, ?missing contains a note that this behavior is subject to
change.

I'm particularly interested in whether the code shown above will
continue to work.  While it does what I want in this case, the
behavior seems a bit surprising since textually the call to inner does
provide an argument.  So it seems possible that might change.

Can anyone provide more insight into how things may change?

Thanks.

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to