From ggrothendieck at gmail.com  Thu Feb 25 18:36:24 2010
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Thu, 25 Feb 2010 12:36:24 -0500
Subject: [Rd] proto and baseenv()
In-Reply-To: <f8e6ff051002250657o7be15ab9ia24b5be410e80e9c@mail.gmail.com>
References: <20100225043854.GA26106@klutometis.wikitex.org> 
	<20100224233350.4e3da5db.misc7@emerose.org>
	<4B8666E0.4070808@TU-Dresden.de> 
	<20100225075038.79ca9b63.misc7@emerose.org>
	<f8e6ff051002250657o7be15ab9ia24b5be410e80e9c@mail.gmail.com>
Message-ID: <971536df1002250936p7987ea51hdc60cf79cad555e2@mail.gmail.com>

On Thu, Feb 25, 2010 at 9:57 AM, hadley wickham <h.wickham at gmail.com> wrote:
>> Presumably if I ask for p$a or p$b later, it's because I'm interesting
>> in the value of "p$a" or "p$b" that I specifically put inside that
>> environment. ?Otherwise I would just ask for "a" or "b". ?If I'm
>> asking for "p$b" it the above case, that means I forgot to declare b
>> inside p. ?In this case there should be an error telling me that, not
>> a silent substitution of the wrong quantity.
>>
>> If someone wanted to do the y$ls() thing, they could always
>>
>>> y <- proto(a=1)
>>> with(y, ls())
>> [1] "a"
>>
>> Another reason is that there are plenty of other programming languages
>> that have similar structures and this behavior is very odd. ?In
>> standard languages asking for "b" inside the "p" object gives you an
>> error, and no one complains.
>
> You might want to have a look at the mutatr package which implements
> prototype OO with the behaviour you're looking for (I think). ?I also
> have a paper available if you email me off list.

I think his objection is really only that he must specify baseenv() to
get the behavior he prefers but from what I understand (I am basing
this on my understanding that mutatr works like io language) in mutatr
one must use Object which seems really no different.



[Rd] proto and baseenv()
Gabor Grothendieck