From luke at stat.uiowa.edu  Mon Mar 16 16:37:30 2009
From: luke at stat.uiowa.edu (luke at stat.uiowa.edu)
Date: Mon, 16 Mar 2009 10:37:30 -0500 (CDT)
Subject: [Rd] Using and 'eval' and environments with active bindings
In-Reply-To: <66f3bd910903151745k42407ec4xb4771fa3e7ef4ac2@mail.gmail.com>
References: <66f3bd910903151745k42407ec4xb4771fa3e7ef4ac2@mail.gmail.com>
Message-ID: <alpine.LFD.2.00.0903161036450.5957@nokomis.stat.uiowa.edu>

Thanks for the report.  I meant to have R_isMissing always return
FALSE for active binding but had it returning TRUE intead.  Fixed now
in R-devel.

luke

On Sun, 15 Mar 2009, Roger D. Peng wrote:

> The following code produces an error in current R-devel
>
> f <- function(value) {
>        if(!missing(value))
>                100
>        else
>                2
> }
> e <- new.env()
> makeActiveBinding("x", f, e)
> eval(substitute(list(x)), e)
>
> The error, after calling 'eval' is
>
> Error in eval(expr, envir, enclos) :
>  element 1 is empty;
>   the part of the args list of 'list' being evaluated was:
>   (x)
>
>
> It has something to do with the change in R_isMissing in revision
> r48118 but I'm not quite knowledgeable enough to understand what the
> problem is. In R 2.8.1 the result was simply
>
>
>> eval(substitute(list(x)), e)
> [[1]]
> [1] 2
>
> I can't say I know what the output should be but I'd like some
> clarification on whether this is a bug.
>
> Thanks,
> -roger
>

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



[Rd] Using and 'eval' and environments with active bindings
luke at stat.uiowa.edu