[squeak-dev] re: About classVariables
craig at netjam.org
Mon Oct 13 20:20:44 UTC 2008
> 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.
improvisational musical informaticist
Smalltalkers do: [:it | All with: Class, (And love: it)]
More information about the Squeak-dev