[Rd] Eval and the enclos argument

2010-10-02 Thread Hadley Wickham
Hi all,

I'm trying to understand the default value of the enclos argument of eval:

  enclos = if(is.list(envir) || is.pairlist(envir)) parent.frame()
else baseenv()

Why isn't it just

  enclos = parent.frame()

given that enclos is only meaningful (given my reading of the
documentation) when envir is not an environment already.

Hadley

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

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


Re: [Rd] Eval and the enclos argument

2010-10-02 Thread Duncan Murdoch

On 02/10/2010 7:57 AM, Hadley Wickham wrote:

Hi all,

I'm trying to understand the default value of the enclos argument of eval:

  enclos = if(is.list(envir) || is.pairlist(envir)) parent.frame()
else baseenv()

Why isn't it just

  enclos = parent.frame()

given that enclos is only meaningful (given my reading of the
documentation) when envir is not an environment already.

Hadley




I think that handles the case of envir=NULL.

Duncan Murdoch

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


Re: [Rd] Eval and the enclos argument

2010-10-02 Thread Hadley Wickham
On Sat, Oct 2, 2010 at 8:18 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 02/10/2010 7:57 AM, Hadley Wickham wrote:

 Hi all,

 I'm trying to understand the default value of the enclos argument of eval:

  enclos = if(is.list(envir) || is.pairlist(envir)) parent.frame()
 else baseenv()

 Why isn't it just

  enclos = parent.frame()

 given that enclos is only meaningful (given my reading of the
 documentation) when envir is not an environment already.

 Hadley



 I think that handles the case of envir=NULL.

So that makes eval(expr, NULL) equivalent to eval(expr, baseenv()), right?

Hadley


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

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


Re: [Rd] Eval and the enclos argument

2010-10-02 Thread Duncan Murdoch

On 02/10/2010 10:40 AM, Hadley Wickham wrote:

On Sat, Oct 2, 2010 at 8:18 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:

On 02/10/2010 7:57 AM, Hadley Wickham wrote:

Hi all,

I'm trying to understand the default value of the enclos argument of eval:

 enclos = if(is.list(envir) || is.pairlist(envir)) parent.frame()
else baseenv()

Why isn't it just

 enclos = parent.frame()

given that enclos is only meaningful (given my reading of the
documentation) when envir is not an environment already.

Hadley



I think that handles the case of envir=NULL.


So that makes eval(expr, NULL) equivalent to eval(expr, baseenv()), right?


I think so.

Duncan

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