[Rd] proto and baseenv()
ggrothendieck at gmail.com
Fri Feb 26 05:42:31 CET 2010
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'))
>  "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
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
> 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.
More information about the R-devel