[squeak-dev] SmalltalkImage current vs. Smalltalk

David T. Lewis lewis at mail.msen.com
Tue Mar 2 16:24:18 UTC 2010

On Mon, Mar 01, 2010 at 08:08:56PM -0800, Andreas Raab wrote:
> Folks -
> I was just trying to load some other code and once too many I got bitten 
> by this silly SmalltalkImage current vs. Smalltalk stuff, so I'll fix it 
> now. The only question is which way. There are two alternatives which 
> achieve the goal of "SmalltalkImage current == Smalltalk":
> 1) The Cuis variant: Move all the code back to SystemDictionary; 
> implement SmalltalkImage current as ^Smalltalk.
> Pro: Compatible with Cuis.
> Con: Lack of separation of concerns.
> 2) The inverse Cuis variant: Move all the code from SystemDictionary to 
> SmalltalkImage; add a 'globals' variable (populated by an instance of 
> SystemDictionary) and convert everything roughly like this:
> 	SmalltalkImage current globals: Smalltalk.
> 	Smalltalk := SmalltalkImage current.
> Pro: Better separation of concerns.
> Con: Different from Cuis.

I favor #1.


The name "SmalltalkImage" sounds like it means something, but I can't
figure out what. Based on the things that it actually implements, I
can't think of any definition that would make sense. The class comment
is meaningless and adds to the confusion.

I honestly can't think of any way to fix "SmalltalkImage" that does
not introduce more incompatibilities, so that leaves the Cuis approach
as my preference.

I do think it may be worth waiting a week or so to see if anyone can
come up with any better approach that meets these criteria:

 - Moves the extraneous behavior out of SystemDictionary, as per the
   original intent of the SmalltalkImage refactoring.
 - Consists only of classes with meaningful class comments and
   clear responsibilities 
 - Preserves "SmalltalkImage current == Smalltalk" for compatibility
 - Preserves the "SmalltalkImage current" idiom for compatibility

I cannot personally think of any good way to do this, but maybe someone
else can.


More information about the Squeak-dev mailing list