[squeak-dev] SmalltalkImage current vs Smalltalk: Option #3

Bert Freudenberg bert at freudenbergs.de
Fri Mar 5 12:53:08 UTC 2010


On 05.03.2010, at 05:24, 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.,
> 
> Behavior>>environment
> 	"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 expected)
> 
> * 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 things.
> 
> What do you think?
> 
> Cheers,
>  - Andreas


After all this discussion I realized I'm basically fine with any solution that allows me to write "Smalltalk" instead of "SmalltalkImage current" so this one sounds good, too. And it may lead to nicer separation of concerns down the road so +1 from me.

Can we also deprecate "SmalltalkImage current"? I'd not be sad if I'd never have to see that expression again - for aesthetic reasons, not because I don't like refactoring :)

- Bert -





More information about the Squeak-dev mailing list