On Thu, Jan 8, 2015 at 6:36 AM, Duncan Murdoch <murdoch.dun...@gmail.com> wrote:
>> val <- get(name, where, ..., value.if.not.found=NULL )   (*)
>
> That would be a bad idea, as it would change behaviour of existing uses of
> get().

Another approach would be if the "not found" behavior consists of a
callback, e.g. an expression or function:

  get(name, where, ..., not.found=stop("object ", name, " not found"))

This would cover the case of not.found=NULL, but also allows for
writing code with syntax similar to tryCatch

  obj <- get("foo", not.found = someDefaultValue())

Not sure what this would do to performance though.

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

Reply via email to