extracting namespace from a property

Brendan Eich brendan at mozilla.org
Thu Mar 1 13:26:57 PST 2007


On Mar 1, 2007, at 9:43 PM, Peter Hall wrote:

>> > IIRC you are allowed to have a dynamic subclass of a non-dynamic
>> > superclass (Jeff correct me if I'm wrong). dynamic is not  
>> inherited,
>> > and applied to a class, it affects only mutability of instances
>> > (whether one can add "expandos", i.e. whether the class "seals"
>> > instances), again if my memory is correct. Others should correct me
>> > or add more information as needed.
>
> I can't see it in the spec, but I was under the impression that, in
> general, dynamic *is* inherited, but Object is made a special
> exception to avoid making every object being dynamic. This is
> important because any code that relies on the fact that an object is
> dynamic (including the class itself) would break if the object turned
> out to be an instance of a subclass that didn't declare itself
> dynamic.

It would break only if the method insisted on adding an ad-hoc  
property to |this|. That's really up to the cooperating sub- and  
super-class implementations to work out. So it is not a contradiction  
to have a non-dynamic subclass of a dynamic super-class.

/be




More information about the Es4-discuss mailing list