[Pharo-project] Instantiating from a Symbol

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Nov 7 15:12:03 EST 2011


2011/11/7 Nick Ager <nick.ager at gmail.com>:
> Hi,
>
>>
>> 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'),
>
> In my image (Pharo 1.3) #environment is defined in Behavior so I need to
> call:
> (self class environment at: #String) new
> have I missed something...
> Nick

It depends where you evaluate the snippet...
Try to evaluate self in workspace, you'll get nil, but ina browser,
you'll get the selected class...

Nicolas




More information about the Pharo-dev mailing list