[Newbies] true/false defined where?
Randal L. Schwartz
merlyn at stonehenge.com
Tue Aug 5 14:52:50 UTC 2008
>>>>> "Sean" == Sean Allen <sean at monkeysnatchbanana.com> writes:
Sean> I have a feeling the secret to unraveling that confusion comes from this:
Sean> 'true and false and some of the very few objects known to the VM'
Sean> does that mean that I can't go and find these variables anywhere? that
Sean> they arent true global variables they are some sort of special global?
If you explore "Smalltalk specialObjectsArray", you'll see a special list of
variables that both the VM and the Smalltalk code have to agree on in order to
run. For example, if a primitive wants to return "false", it has to
know what the rest of the Smalltalk image considers the sole instance
of the "False" class.
These items are established in
"SystemDictionary>>#recreateSpecialObjectsArray", the first version of which
had to be executed essentially "by hand" on the first VM (either the early
versions of Smalltalk 76 or 80). Since then, this special array has gotten
its initial values by running it in an already running system, so the first
few entries there (nil, false, true) are in fact clones of clones of clones of
the original handcrafted objects. Of course, there's code on the VM side that
knows the precise order of this magical array, and this is what allows them to
communicate, so you can't just add new things here or change the ordering
without building a corresponding new VM.
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
More information about the Beginners