Umm, maybe we should step back a bit here. There are two points being made, both of which I think are reasonable, but they just don't happen to work together.
1. Environments are special objects in R. In fact they are the essential way directly in R to implement reference semantics. Every object that has an environment (say, as a slot), has the same object. Much of R depends on this semantic property. 2. For any "class" in the language, it would be useful to define a class that extends (contains) that class, but has additional properties. The essential reason 2 conflicts with 1 for environments is that slots and other properties of objects are implemented as attributes, including class(x). Attributes are implemented inside the struct that holds the object itself. This means you can not have an object of another class that contains an environment, in the same way you would with a non-reference object, without wiping out properties of the "contained" object. You do get told this, in the simplest case anyway. For example, suppose I want a class that acts like an environment but also has a slot "source" for some extra information: > setClass("e2", representation(source="character"), contains = "environment") [1] "e2" Warning message: class "environment" cannot be used as the data part of another class in: reconcilePropertiesAndPrototype(name, slots, prototype, superClasses, and indeed the new class doesn't work as you would expect. So the question is whether we want to enforce that limitation, in which case we probably need a stronger slap on the wrist, or whether we should consider a different implementation for this case, to allow the new class to inherit the properties of an environment, without violating the integrity of environments. I kind of like the second approach, but only if it does not overly mess with the general approach to classes. Gabor Grothendieck wrote: >On 7/5/06, Duncan Murdoch <[EMAIL PROTECTED]> wrote: > > >>On 7/5/2006 8:06 PM, Gabor Grothendieck wrote: >> >> >>>On 7/5/06, Duncan Murdoch <[EMAIL PROTECTED]> wrote: >>> >>> >>>>On 7/5/2006 4:33 PM, Gabor Grothendieck wrote: >>>> >>>> >>>>>On 7/5/06, Duncan Murdoch <[EMAIL PROTECTED]> wrote: >>>>> >>>>> >>>>>>On 7/5/2006 3:47 PM, Gabor Grothendieck wrote: >>>>>> >>>>>> >>>>>>>On 7/5/06, Duncan Murdoch <[EMAIL PROTECTED]> wrote: >>>>>>> >>>>>>> >>>>>>>>On 7/5/2006 2:23 PM, Gabor Grothendieck wrote: >>>>>>>> >>>>>>>> >>>>>>>> <etc.> >______________________________________________ >R-devel@r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-devel > > > ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel