From ggrothendieck at gmail.com  Sat Nov 14 01:26:44 2009
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Fri, 13 Nov 2009 19:26:44 -0500
Subject: [Rd] The default behaviour of a missing entry in an environment
In-Reply-To: <4AFDF822.5050602@stats.uwo.ca>
References: <D737F65B-A317-44C1-8421-E8DE2D0E0740@nyu.edu> 
	<4AFDB33D.5010607@stats.uwo.ca>
	<971536df0911131539o5d702723u63645580bef5f1f@mail.gmail.com> 
	<4AFDF822.5050602@stats.uwo.ca>
Message-ID: <971536df0911131626k21bd7cefk391ad821b42170b6@mail.gmail.com>

On Fri, Nov 13, 2009 at 7:21 PM, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
> On 13/11/2009 6:39 PM, Gabor Grothendieck wrote:
>>
>> Note that one should use inherits = FALSE argument on get and exists
>> to avoid returning objects from the parent, the parent of the parent,
>> etc.
>
> I disagree. ?Normally you would want to receive those objects. ?If you
> didn't, why didn't you set the parent of the environment to emptyenv() when
> you created it?
>

$ does not look into the parent so if you are trying to get those
semantics you must use inherits = FALSE.

> x <- 3
> e <- new.env()
> "x" %in% names(e)
[1] FALSE
> get("x", e) # oops
[1] 3



[Rd] The default behaviour of a missing entry in an environment
Gabor Grothendieck