<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Oct 13, 2008 at 2:02 AM, Martin Beck <span dir="ltr">&lt;<a href="mailto:martin.beck@hpi.uni-potsdam.de">martin.beck@hpi.uni-potsdam.de</a>&gt;</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>
&gt;<br>
&gt; Hi Stef--<br>
&gt;<br>
&gt;&gt; To my stupefaction I discovered that the classVariables of a class are<br>
&gt;&gt; not the same as the ones of its metaclass.<br>
&gt;&gt;<br>
&gt;&gt; TheRoot classVarNames ~= TheRoot class classVarNames<br>
&gt;&gt;<br>
&gt;&gt; Does any body have some ideas why this is like that? For me this is a<br>
&gt;&gt; conceptual bug.<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp;Actually, metaclasses don&#39;t really have class variables at all.<br>
&gt; Class variables are defined by Class, which is a sibling of Metaclass,<br>
&gt; not a superclass. There&#39;s a method in Behavior which just answers a new<br>
&gt; empty Set for classVarNames; this is what you&#39;re invoking when you<br>
&gt; evaluate [TheRoot class classVarNames].<br>
&gt;<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&lt;-----------</div><div></div></div><div><div>!Metaclass methodsFor: &#39;class variables&#39; stamp: &#39;eem 10/13/2008 12:37&#39;!</div>
<div>classVarNames</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;Answer a Set of the names of the class variables defined in the receiver&#39;s instance.&quot;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^thisClass classVarNames! !</div>
<div><div>------------8&lt;-----------</div><div></div></div><div>c.f. Metaclass&gt;&gt;classPool.<br></div></div></div><div><br></div><div class="gmail_quote"><div><div>But a better fix is to move Class&gt;&gt;classVarNames to ClassDescription:</div>
<div>------------8&lt;-----------</div><div><div>&#39;From Croquet1.0beta of 11 April 2006 [latest update: #1] on 13 October 2008 at 12:41:36 pm&#39;!</div><div><br></div><div>!ClassDescription methodsFor: &#39;class variables&#39; stamp: &#39;eem 10/13/2008 12:41&#39;!</div>
<div>classVarNames</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>&quot;Answer a Set of the names of the class variables defined in the receiver.&quot;</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&lt;-----------</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. &nbsp;Code compiled in &nbsp;the context of a metaclass includes the class variables of the non-metaclass (metaclass&#39;s instance), otherwise one couldn&#39;t access class variables in class-side methods.</div>
</div>