Wacek Kusnierczyk wrote:
> Gabor Grothendieck wrote:
>   
>> The argument to eval.parent is evaluated before eval.parent
>> ever sees it. 
>>     
>
> really?  eval.parent is just a regular r function, a wrapper for eval
> with envir=parent.frame().  the arguments to eval.parent are passed to
> eval *unevaluated* (as promises), and are only evaluated when eval needs
> them.  

to be strict, the argument n to eval.parent is not further passed to
eval, and is evaluated before eval is called.  the above referred to the
'expr' argument to eval.parent.  one more example:

my.eval.parent = function(expr, n=1) {
    print('foo')
    p = parent.frame(n+1)
    eval(expr, p) }
trace(eval)
my.eval.parent({print('expr'); 1}, {print('n'); 1})
# "foo"
# "n"
# trace eval(expr, p)
# "expr"
# 1


vQ

______________________________________________
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