[squeak-dev] Re: About classVariables

nicolas cellier ncellier at ifrance.com
Mon Oct 13 20:42:42 UTC 2008


Craig Latta a écrit :
> 
> Hi Eliot--
> 
>  > Whoever said that the class variables of a metaclass should be those
>  > of Metaclass is very wrong. Code compiled in the context of a
>  > metaclass includes the class variables of the non-metaclass
>  > (metaclass's instance), otherwise one couldn't access class variables
>  > in class-side methods.
> 
>      I think you're confusing metalevels. If I compile a class-side 
> method for Array, and I use a class variable, conceptually it's one of 
> Array's class variables I'm using, yes? What the class variables of 
> (Array class) might be is irrelevant. Yes, during compilation, 
> Metaclass>>scopeHas:ifTrue: delegates to the receiver's sole instance, 
> but that doesn't mean that a metaclass has the same class variables as 
> its sole instance.
> 
>      To say otherwise is to introduce a conceptual inconsistency into 
> the system: the class variables of an object are defined by its class, 
> except if that object is a metaclass. Further, suppose the class 
> variables pool for Metaclass were not empty. By your logic instances of 
> Metaclass don't have access to it.
> 
>      I guess we disagree here.
> 
> 
> -C
> 
> -- 
> Craig Latta
> improvisational musical informaticist
> www.netjam.org
> Smalltalkers do: [:it | All with: Class, (And love: it)]
> 
> 
> 

That's how it works indeed, but the example I provided sounds then like 
very misleading (a bug?):

UndefinedObject class allClassVarNames includes: #ObsoleteSubclasses.

which is a class var of Behavior...




More information about the Squeak-dev mailing list