[Newbies] invoking a *class* method from a workspace
subbukk at gmail.com
Tue Jun 5 05:55:45 UTC 2007
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!
Thanks a lot .. Subbu
More information about the Beginners