<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Oct 13, 2008 at 2:02 AM, Martin Beck <span dir="ltr"><<a href="mailto:martin.beck@hpi.uni-potsdam.de">martin.beck@hpi.uni-potsdam.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d">Craig Latta wrote:<br>
><br>
> Hi Stef--<br>
><br>
>> To my stupefaction I discovered that the classVariables of a class are<br>
>> not the same as the ones of its metaclass.<br>
>><br>
>> TheRoot classVarNames ~= TheRoot class classVarNames<br>
>><br>
>> Does any body have some ideas why this is like that? For me this is a<br>
>> conceptual bug.<br>
><br>
> Actually, metaclasses don't really have class variables at all.<br>
> Class variables are defined by Class, which is a sibling of Metaclass,<br>
> not a superclass. There's a method in Behavior which just answers a new<br>
> empty Set for classVarNames; this is what you're invoking when you<br>
> evaluate [TheRoot class classVarNames].<br>
><br>
</div>However,<br>
<br>
TheRoot classPool = TheRoot class classPool<br>
<br>
evaluates to true...<br>
<br>
Regards,<br>
<font color="#888888">Martin<br></font></blockquote><div><br></div><div>One fix is to add the following method:</div><div><div>------------8<-----------</div><div></div></div><div><div>!Metaclass methodsFor: 'class variables' stamp: 'eem 10/13/2008 12:37'!</div>
<div>classVarNames</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>"Answer a Set of the names of the class variables defined in the receiver's instance."</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^thisClass classVarNames! !</div>
<div><div>------------8<-----------</div><div></div></div><div>c.f. Metaclass>>classPool.<br></div></div></div><div><br></div><div class="gmail_quote"><div><div>But a better fix is to move Class>>classVarNames to ClassDescription:</div>
<div>------------8<-----------</div><div><div>'From Croquet1.0beta of 11 April 2006 [latest update: #1] on 13 October 2008 at 12:41:36 pm'!</div><div><br></div><div>!ClassDescription methodsFor: 'class variables' stamp: 'eem 10/13/2008 12:41'!</div>
<div>classVarNames</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>"Answer a Set of the names of the class variables defined in the receiver."</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^self classPool keys! !</div>
<div><br></div><div>Class removeSelector: #classVarNames!</div></div></div><div><div><div>------------8<-----------</div><div></div></div></div></div><div><br></div><div>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.</div>
</div>