Help with creating methods from workspace
Hans-Martin Mosner
hmm at heeg.de
Fri Sep 30 19:52:47 UTC 2005
Valdas Bucinskas wrote:
>Hello !
>
>How do I create a simple method from workspace? I want to execute
>smth like
>
>MyClass createMethod: 'methodName' sourse: '^true' in: 'instance-side'
>
>Help please.
>
>
>
Simple:
sourceCode := 'methodName
^true'.
MyClass compile: sourecCode classified: 'method category'
Note that you have to put selector and body into one string.
For a method on the class side, just use "MyClass class" instead of
"MyClass".
Cheers,
Hans-Martin
More information about the Squeak-dev
mailing list
|