Re: [Rd] attributes of environments

From: Gabor Grothendieck <>
Date: Wed 05 Jul 2006 - 20:33:25 GMT

On 7/5/06, Duncan Murdoch <> wrote:
> On 7/5/2006 3:47 PM, Gabor Grothendieck wrote:
> > On 7/5/06, Duncan Murdoch <> wrote:
> >> On 7/5/2006 2:23 PM, Gabor Grothendieck wrote:
> >> I think by this time I have shown that subclassing of
> >> > environments does not work yet it could if it were designed differently
> >> > and furthermore there are significant problems with the workarounds.
> >>
> >> I don't think you've shown that subclassing of environments doesn't
> >> work. You have an example that shows that shows that R implements
> >> Henrik's "Case 2" rather than his "Case 1", but as Thomas and I said,
> >> that really has nothing to do with subclassing.
> >>
> >> Subclassing is about defining a new class, not about copying objects.
> >> You can (and did!) define a new class which inherits from the
> >> environment class.
> >
> > But by subclassing in the way allowed one comes up with something that
> > is not useful.
> You haven't shown that. Show an example where you define a new class
> that should inherit from environment but doesn't.
> All you've shown so far is that when you try to change the class of an
> object to a new class, it appears that the class of another object also
> changes. (The explanation being that they are really just different
> names for the same object.)

But that is not how oo works. When one defines a child its a delta to the parent. It does not change the parent.

Your parenthesized statement discussed why it works that way under the current design but that is not inevitable. The current design is not the only possibility.

> > That is why tcltk and Henrik's package wrap environments in lists and define
> > a completely different class but by doing that they are not able to take
> > advantage of inheritance.
> I think they did that because they wanted explicit references to
> objects, rather than the built-in implicit ones. I've wanted explicit
> references to things on a number of occasions too, but that's really
> unrelated to inheritance as far as I can see.

They are defining environments with special features yet they can't make use of inheritance as they injected the environment object into their object rather than subclassing it -- understandable given the current limitations. mailing list Received on Thu Jul 06 06:36:04 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 05 Jul 2006 - 22:28:09 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.