A class from a string name

Stijn Timbermont stijn.timbermont at gmail.com
Wed Dec 14 18:26:08 UTC 2005


Compiler evaluate: 'MyClass methodName: arg'

won't work, because the Compiler will not be able to see arg

Smalltalk classNamed: clsName. is the best way I think, clsName may be
a string or a symbol, it can also be 'MyClass class' (or #'MyClass
class')

even better is
self class environment: classNamed: clsName.
that way your code will also work in a partitioned system (not all
classes in the Smalltalk global)

- Stijn

On 12/14/05, hjh-sqlist <hjh-sqlist at lexdb.net> wrote:
> What about
>
>      Compiler evaluate: 'MyClass methodName'.
>
> ?
>
> http://www.oldenbuettel.de/squeak-doku/System-Compiler/Compiler.html#metaevaluate:
>
>
> Hannes
>
>
>



More information about the Squeak-dev mailing list