On Jun 5, 2007, at 7:55 , subbukk wrote:
On Tuesday 05 June 2007 1:21 am, Bert Freudenberg wrote:
class (instance variable) - instance variable of the class (treated as an object and therefore visible only to its methods and methods in its subclasses).
I don't think that is correct - what do you mean by "treated as an object"? I may be repeating myself, but *everything* is "treated as an object", because it is.
In Smalltalk, classes are first order objects. I need to keep reminding myself about this :-) because in many imperative languages this is not true.
Smalltalk allClasses select: [:ea | ea class instVarNames size > 0]
Thanks for this hint. This is what I needed: Smalltalk allClasses select: [ :c | c class instVarNames size > 0 ] thenCollect: [ :c | c -> c class instVarNames ].
I had dropped the 'class' method and instVarNames didn't work. No wonder. 28 classes out of 2043 define their own instance variables. Rare indeed!
And even of these few, some are in error and should really be class vars instead.
- Bert -