Hi Marcus, On 07 Nov 2011, at 15:29, Markus Rother wrote:
Hello everybody,
I am fairly new to ST and have been following this list since a few weeks.
A very brief introduction of myself: I am a 32 year old student of informatics with a degree in political sciences. Currently i am located in Regensburg, Germany. Most of my previous programming was in python, along with some php and javascript.
The issue I could not solve on my own is this: I would like to instantiate from symbols. My use-case is a collection of class names which I want to ask to return one instance each.
Such that: #Foo asClass new -> a Foo whereas asClass is the method I am looking for.
I am using Pharo 1.3.
I did not find any description of what I want to achieve on the internet.
Many thanks in advance, Markus
Welcome! Traditionally, one would do this: (Smalltalk at: #String) new Smalltalk here is not a class, but a global variable whose value is a SystemDictionary mapping class names to class objects. Pharo is working towards less dependency on globals like these, so the new way would be like this: (self environment at: #String) new (Where environment essentially does 'Smalltalk globals'), HTH, Sven