[R] evaluation revisited

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Wed Jan 28 14:29:02 CET 2009


Gabor Grothendieck wrote:
> On Wed, Jan 28, 2009 at 6:26 AM, Wacek Kusnierczyk
> <Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> 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.  here's a modified eval.parent:
>>     
>
> Yes, you're right about the mechanism although quoting the
> help page its nevertheless true that it:
> "evaluates its first argument in the current scope before
> passing it to the evaluator"
>   
... where 'current scope' is as clear as the sky over trondheim right
now [1], the issue being:

- is 'current scope' the scope in which eval (the above quote refers to
eval) is called (as it seems to be meant), or
- the scope *within* the call to eval (which would be intuitively
obvious, since when eval 'evaluates' it must have already been entered
and not yet left, so we're inside the eval-call scope).

another example of how quoting an r help page helps provided you already
know the answer. 
must admit that 'eval evaluates its argument before passing it to the
evaluator' is quite funny a quote;  so eval is able to evaluate without
an evaluator?  magic!

*what* is it that is true, quoting the help page?

vQ






[1]
http://www.yr.no/place/Norway/S%C3%B8r-Tr%C3%B8ndelag/Trondheim/Trondheim/




More information about the R-help mailing list