> No, defaults are evaluated in the evaluation frame of the function. That's
> why you can use local variables in them, e.g. the way rgamma uses 1/rate as
> a default for scale.

Oops, yes, I was getting confused with promises - non-missing
arguments are promises evaluated in the parent frame.

> But the point isn't evaluation here:  the point is the parsing.  A function
> gets its source attribute when it is parsed, so getSrcFilename needs to be
> passed something that was parsed in the script.

Still, it would be nice to have a function that, by default, would
return the location of the calling script.  You can also hack
something together using sys.frames(), but it would be nice to have
official R support for it.

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to