<div dir="ltr">Hi HM<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 19, 2015 at 10:23 AM, Hans-Martin Mosner <span dir="ltr"><<a href="mailto:hmm@heeg.de" target="_blank">hmm@heeg.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
<div>Am 19.08.2015 um 18:58 schrieb Chris
Cunningham:<br>
</div>
<blockquote type="cite">
<div dir="ltr">I create a class with variables:
<div><br>
</div>
<div>Object subclass: #ClassOrderExample</div>
<div><span style="white-space:pre-wrap"> </span>instanceVariableNames:
'a d e c b'</div>
<div><span style="white-space:pre-wrap"> </span>classVariableNames:
'A D E C B'</div>
<div><span style="white-space:pre-wrap"> </span>poolDictionaries:
''</div>
<div><span style="white-space:pre-wrap"> </span>category:
'Example'</div>
<div>(in that order, because that is the right order).
<div><br>
</div>
<div>As soon as I save the class:</div>
<div><br>
</div>
<div>
<div>Object subclass: #ClassOrderExample</div>
<div><span style="white-space:pre-wrap"> </span>instanceVariableNames:
'a d e c b'</div>
<div><span style="white-space:pre-wrap"> </span>classVariableNames:
'A B C D E'</div>
<div><span style="white-space:pre-wrap"> </span>poolDictionaries:
''</div>
<div><span style="white-space:pre-wrap"> </span>category:
'Example'</div>
</div>
<div><br>
</div>
<div>Why?</div>
<div><br>
</div>
<div>Note that the instance variables aren't sorted.</div>
</div>
<div><br>
</div>
<div>(using 5.0 - not sure if that is relevant or not)</div>
<div><br>
</div>
<div>-cbc</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre></pre>
</blockquote></div></div>
instance variables are ordered (their order determines their inst
var slot index, so Smalltalk can't just shuffle them around).<br>
Class variables are keys in a Dictionary, so essentially unordered.
To make it easier for users to find a given class variable in the
definition, Smalltalk sorts them alphabetically (otherwise the order
could change inexplicably when the Dictionary would be rehashed
after a new one is inserted.)<br></div></blockquote><div><br></div><div>Also, sorting means that code comparison (e.g. on loading a package to identify changes) isn't confused by different permutations of the same set of class variables.</div></div><br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>