[Newbies] How to access a Squeak class
Herbert König
herbertkoenig at gmx.net
Tue Jan 16 13:33:35 UTC 2007
Hello Warakorn,
HK> try:
HK> Smalltalk at: #MonthMorph inspect
I got some more time, so here is a longer Version:
Smalltalk is a Dictionary which afaik contains the names of all global
symbols. So if you got a String, send it asSymbol and then look it up
in that Dictionary.
Actually Smalltalk is a SystemDictionary, if you are interested in
exploring. The class comment has an example.
Before writing or removing entries in this Dictionary, make sure you
know what you're doing :-))
So your code should be something like:
returnSuperClass: aClassName
|aSuperClass aClass|
aClass := Smalltalk at: aClassName asSymbol.
aSuperClass := aClass superclass.
^ aSuperClass.
Cheers
Herbert
More information about the Beginners
mailing list