From ggrothendieck at gmail.com  Fri Feb 26 05:42:31 2010
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Thu, 25 Feb 2010 23:42:31 -0500
Subject: [Rd] proto and baseenv()
In-Reply-To: <20100226041617.GB21674@klutometis.wikitex.org>
References: <20100225043854.GA26106@klutometis.wikitex.org> 
	<20100224233350.4e3da5db.misc7@emerose.org>
	<4B8666E0.4070808@TU-Dresden.de> 
	<20100225075038.79ca9b63.misc7@emerose.org>
	<4B868B1A.5050409@stats.uwo.ca> 
	<20100225194919.00b10700.misc7@emerose.org>
	<20100226022322.GB19263@klutometis.wikitex.org> 
	<971536df1002251931r4972bcdes9c6910423fc52af6@mail.gmail.com> 
	<20100226041617.GB21674@klutometis.wikitex.org>
Message-ID: <971536df1002252042q40b9b00do23b24370ea919482@mail.gmail.com>

On Thu, Feb 25, 2010 at 11:16 PM, Peter Danenberg <pcd at roxygen.org> wrote:
>> Your preference is inconsistent with how the rest of R works and is
>> inflexible since everything inherits from Object.
>
> Really? Here are a couple of counterexamples in S3 and S4 objects:
>
> ?> z <- 1
> ?>
> ?> ## S4
> ?> setClass('A', representation(a='numeric'))
> ?[1] "A"
> ?> a <- new('A', a=z)
> ?> a at z
> ?Error: no slot of name "z" for this object of class "A"
> ?>
> ?> ## S3
> ?> a <- structure(list(a=z), class='A')
> ?> a$z
> ?NULL
>

lists don't have inheritance at all so the last example seems not
relevant.  Also other object systems which are alternatives to proto
seem less relevant than basic scoping and free variable lookup in
functions.  Those are the relevant principles.

> As far as flexibility is concerned: keep the ability of people to
> inherit from the parent environment if they don't mind
> namespace-pollution and unpredictability.

proto does that but uses the consistent default rather than the
inconsistent default that you prefer.

The namespace advantage is an advantage but its lesser than
consistency with R and the flexibility to have it either way.

> I'm merely asking that the default behavior resemble the twenty-three
> years of precedent since Ungar's original Self paper.

That is just what I (and possibly Duncan) have argued.  That your
expectation is based on different systems.

>
>> Also I think your argument is based partly on repeating the original
>> erroneous (relative to the writer's intention) proto code without
>> repeating my correction confusing the discussion with simple user
>> error.
>
> I acknowledged your correction in an earlier email when I stated that,
> "[one has] to choose between eval and parent pollution."

But the last email repeated the wrong code anyways and used that as
the springboard for the discussion.



[Rd] proto and baseenv()
Gabor Grothendieck