[squeak-dev] re: About classVariables
stephane ducasse
stephane.ducasse at free.fr
Tue Oct 14 12:42:22 UTC 2008
> One fix is to add the following method:
> ------------8<-----------
> !Metaclass methodsFor: 'class variables' stamp: 'eem 10/13/2008
> 12:37'!
> classVarNames
> "Answer a Set of the names of the class variables defined in the
> receiver's instance."
>
> ^thisClass classVarNames! !
> ------------8<-----------
> c.f. Metaclass>>classPool.
>
> But a better fix is to move Class>>classVarNames to ClassDescription:
> ------------8<-----------
> 'From Croquet1.0beta of 11 April 2006 [latest update: #1] on 13
> October 2008 at 12:41:36 pm'!
>
> !ClassDescription methodsFor: 'class variables' stamp: 'eem
> 10/13/2008 12:41'!
> classVarNames
> "Answer a Set of the names of the class variables defined in the
> receiver."
>
> ^self classPool keys! !
>
> Class removeSelector: #classVarNames!
> ------------8<-----------
>
> 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.
Tx
Stef
More information about the Squeak-dev
mailing list
|