[squeak-dev] Re: The solution of (Was: Creating an image from first principles)

Andreas Raab andreas.raab at gmx.de
Thu Aug 7 04:55:54 UTC 2008


Igor Stasenko wrote:
> 2008/8/7 Andreas Raab <andreas.raab at gmx.de>:
>> This doesn't work (try it sometime). It is impossible to create an empty
>> metaclass hierarchy since you can't send any messages to it. Which is why
>> you need a simulator to do it because the simulator can operate on the data
>> structures without requiring any of the objects to understand any message.
>> Most of the steps in your proposal have similar fundamental flaws (like
>> creating "new" SmallInteger instances etc).
>>
> 
> Oh, come on!

Your line of argumentation reminds me of the old S. Harris cartoon:

http://www.sciencecartoonsplus.com/pages/gallery.php

The problem is that you simply cannot have an uncontaminated environment 
without the simulator. It is trivial to show: Since you cannot 
manipulate objects without sending messages, you will *necessarily* have 
to send messages from the "old" to the "new" objects while the new 
environment is being constructed. This *necessarily* implies that the 
classes, metaclasses, literals, and methods of the "new" environment 
will start out as instances of the "old" environment. There is simply no 
way around this.

And that ultimately means that what you're creating is just a (modified) 
clone of the old environment not an environment that I would consider to 
be created from "first principles" (note that I'm not saying that such a 
clone might not be useful, I'm just not interested in yet another 
cloning approach).

Cheers,
   - Andreas

> Not sure if it will work, but hey:
> 
> Behavior subclass: #BootsrappingBehavior .
> 
> Which having special 'intercepting'  #basicNew and #basicNew: method
> with something like:
> 
> | newObject |
> newObject := super basicNew.
> newObject primitiveChangeClassTo: (Substitutions
> findOrCreateSubstitutionOf: self).
> NewHeap add: newObject.
> ^ newObject
> 
> and then:
> 
> ClassDescription superclass: BootstrappingBehavior.
> Behavior flushCache.
> 
> ".. now you can run arbitrary code, and all objects created during it
> will eventually find themselves in NewHeap and already with proper
> class set.
> 
> At the end, you reverting hack:
> "
> 
> ClassDescription superclass: Behavior.
> Behavior flushCache.
> 
> 
> Another thing, that you can populate method dicts on the fly while code running:
> 
> [ newObject some code involving sending potentially unknown messages
> to an object which class having empty method dict ] on:
> MessageNotUnderstood do: [:ex |
>     (NewHeap findAndCompileAndInstallMethodForMessage: ex message
> receiver: ex receiver) ifTrue: [
>       ex return: ex message value. ] ifFalse: [
>     ex pass. ]
> ].
> 
> 
>> FWIW, I've followed a similar set of ideas for a while back in 2002 and the
>> end result was dead-ugly and impossible to bootstrap cleanly. Every step of
>> your proposal is a mine field and the only recommendation I have is to try
>> it sometime and you'll be *amazed* how difficult the process is that you are
>> describing.
>>
> 
> I like to be amazed and i like to be challenged :)
> 
>> Cheers,
>>  - Andreas
>>
> 
> 




More information about the Squeak-dev mailing list