What makes you think it does not return a class object? It does.
But note that you have to use a symbol (#Object) not a String
('Object') when you use #at:. Of course. '#Object' does not make any
sense. If you use #classNamed:, both a String and a Symbol will work.
- Bert -
On Jan 16, 2007, at 14:41 , Warakorn Paphrawat wrote:
This doesn't work either, because again (Smalltalk at: aClassName)
is returning just a ByteString but not (e.g.) Object class
or (e.g.) ClassBuilder class .
Lets assume in the calling method is written:
returnSuperClass: '#Object'.
Note: the Argument must be an instance of String.
returnSuperClass: aClassName
|aSuperClass|
aSuperClass := (Smalltalk at: aClassName) superclass.
^ aSuperClass.
Nope, this does'nt work.
Herbert König <[EMAIL PROTECTED]> wrote: Hello Warakorn,
try:
Smalltalk at: #MonthMorph inspect
Cheers
Herbert mailto:[EMAIL PROTECTED]
WP> Hi !
WP> Actually it is probably a very simple Squeak concept which I
haven't understood, yet.
WP> Serving as an simple example, I would like to write a method,
WP> which accepts a Class as argument and which return the Superclass
WP> of that Class.
WP> The problem is that the argument must be an instance of
WP> String, that means the argument aClassName contains an actual
WP> class name (e.g. aClassName = 'Object'. or aClassName =
WP> 'ClassBuilder'), however, this is just a String object.
WP> returnSuperClass: aClassName
WP> |aSuperClass|
WP> aSuperClass := aClassName superclass.
WP> ^ aSuperClass.
WP> Obviously this method won't work, because aClassName is just
WP> an instance of ByteString. And instances of ByteString cannot
WP> understand the message superclass.
WP> So I need the actual class object which the content of the
String aClassName represents.
WP> How can I achieve ? Or how can I make this method correct ?
WP> (it is imperative, that the argument aClassName is a String).
WP> Thanks for you help in advance.
WP> Best Regards
WP> Warakorn
WP> Have a burning question? Go to Yahoo! Answers and get answers
from real people who know.
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Don't get soaked. Take a quick peak at the forecast
with theYahoo! Search weather shortcut.
_______________________________________________
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