[squeak-dev] Re: SmalltalkImage current vs Smalltalk: Option #3
andreas.raab at gmx.de
Sat Mar 6 06:14:01 UTC 2010
After the positive feedback I went ahead and implemented the plan. Sorry
for the commit-spam, but it's all in place now, meaning:
1) Smalltalk == SmalltalkImage current
2) Smalltalk class == SmalltalkImage
3) Smalltalk globals class == SystemDictionary
4) SomeClass environment == Smalltalk globals
A special place in heaven will be reserved for Nicolas' little script to
find all the messages sent to Smalltalk without which fixing all the
dictionary accesses would have taken ages. Thank you, thank you, thank you.
I have deprecated several dictionary methods in SmalltalkImage instead
of removing them since some of them were heavily used and may very well
show up in external packages. Others were used by binary storage
(SmartRefStream, ImageSegment) and have been tagged as such. I'd be
interested in people trying to load binary stuff that has been written
before the change to ensure this all works as expected.
I have also taken the liberty to remove some cruft from SmalltalkImage -
methods that were literally ten years old, not called, and not serving
any observable purpose. If you miss one, let me know and we'll restore
'em but SmalltalkImage and SystemDictionary look much nicer without them
(check 'em out; it's pretty sweet).
I believe everything is healthy and in good working order but if you
find bugs, let me know. There's always the possibility of something
I'll leave the pass on converting SmalltalkImage current -> Smalltalk
for someone else :-)
On 3/4/2010 8:24 PM, Andreas Raab wrote:
> Folks -
> I've been working on this stuff a little now and (as always) things look
> different once you actually dug into it. There is a really interesting
> option here which I'd like to propose as option #3 since it does require
> a bit of refactoring but it makes good sense to me:
> * Move methods from SystemDictionary to SmalltalkImage.
> * Make SmalltalkImage current == Smalltalk.
> * Make Smalltalk globals class == SystemDictionary
> So far we're still with option #2, but now it gets interesting:
> * Use Smalltalk globals as Behavior>>environment, i.e.,
> "Return the environment in which the receiver is visible"
> ^Smalltalk globals
> * Remove any non-dictionary stuff from SystemDictionary; fix all
> non-dictionary uses of "self environment" (VERY few; much less than I
> * Remove all the dictionary methods from SmalltalkImage except #at:,
> #at:ifAbsent:, #at:ifPresent: (there simply are too many users of those
> to get rid of it but it avoids literally some 20+ methods that are
> required otherwise)
> The result is that:
> 1) Smalltalk == SmalltalkImage current
> 2) Smalltalk class == SmalltalkImage
> 3) Smalltalk globals class == SystemDictionary
> 4) SomeClass environment == Smalltalk globals
> Interestingly, this is pretty much the way these entities are already
> used; just not consistently. After browsing through quite a bit of code
> that does feel like the most natural separation - the environment as the
> dictionary / namespace; Smalltalk as the system-wide facade for various
> What do you think?
> - Andreas
More information about the Squeak-dev