[Newbies] How to add a method via a method?

Dirk Klaschus klaschus at googlemail.com
Sun Mar 9 21:40:45 UTC 2008


Hello, I want to write a message with a String-argument,
which adds a new method to MyClass:
 ---------------------------------------------------------
aMethod: 'MyClass'
 ---------------------------------------------------------

This is what I wrote for aMethod:
---------------------------------------------------------
aMethod: myClassWhichExist
 "comment stating purpose of message"

 myClassWhichExist compile: 'myMethod
 "comment stating purpose of message"
 | h |
 h:= ''Hello''.
 ^ h.' classified: 'delete'
 ---------------------------------------------------------

I get the following error message:
---------------------------------------------------------
ByteString(Object)>>error:
error: aString
 "Throw a generic Error exception."
 ^ Error new signal: aString
 ---------------------------------------------------------

I understand that the class name 'myClassWichExist' as string-argument
doesn't go along with the compile-message.  But to what do I need to convert
the string-argument to make it work?
Many thanks in advance for your answers.

Olitizia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080309/6e3316ea/attachment.htm


More information about the Beginners mailing list