I create a class with variables:
Object subclass: #ClassOrderExample instanceVariableNames: 'a d e c b' classVariableNames: 'A D E C B' poolDictionaries: '' category: 'Example' (in that order, because that is the right order). As soon as I save the class: Object subclass: #ClassOrderExample instanceVariableNames: 'a d e c b' classVariableNames: 'A B C D E' poolDictionaries: '' category: 'Example' Why? Note that the instance variables aren't sorted. (using 5.0 - not sure if that is relevant or not) -cbc |
Am 19.08.2015 um 18:58 schrieb Chris
Cunningham:
instance variables are ordered (their order determines their inst var slot index, so Smalltalk can't just shuffle them around). 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.) Cheers, Hans-Martin |
Hi HM
On Wed, Aug 19, 2015 at 10:23 AM, Hans-Martin Mosner <[hidden email]> wrote:
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. _,,,^..^,,,_ best, Eliot |
Free forum by Nabble | Edit this page |