A better alternative would be

        Smalltalk classNamed: 'Object'

avoiding the "low level" #at: and #asSymbol protocol. Does some more checks, too.

- Bert -

On Jan 16, 2007, at 14:33 , Herbert König wrote:

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


_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners




_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to