On Thursday, August 5, 2010, Mariano Martinez Peck
<[email protected]> wrote:
> Hi. I know this is a newbie question, but there is something I don't 
> understand about globals.
>
> I am writing a piece of code, and I refer to "a class" that does exist. 
> Suppose:
>
> testSomething
>
>     NonExistenteClass
>
>
> Whem I accept the method, a popup brings saying it doesn't exist...etc. Then, 
> I can define as global.
>
> If I then evaluate:   Smalltalk globals at: #NonExistenteClass
>
> the key exist and it has nil as value. Perfect.
>
> So..if I understand well, all these globals variables AND classes are stored 
> in this globals, which is the only instance of SystemDictionary (for the 
> moment).
>
> Now my question is, where are nil, true, false, etc stored?

Magic in the compiler. They are also referenced  in the special objects array.

> I know there are only one instance of  UndefinedObject, False, True, etc have 
> only one instance...but WHERE are they stored? who keep them?  They don't 
> seem to be in SystemDictionary. Why no?

Efficiency. There are special bytecodes to push them.

AFAIK Gemstone is the only Smalltalk that has them in the "SystemDictionary".

Lukas

>
> I did a "chase pointers" to nil for example, and it says
> "CLASS: SmalltalkImage class
> subclasses: UndefinedObject"
>
> I still don't understand :(
>
> Thanks for any hints
>
> Mariano
>
>

-- 
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to