Why Interpreter isa ObjectMemory

Tim Rowledge tim at sumeru.stanford.edu
Sun Feb 24 23:25:42 UTC 2002


"PhiHo Hoang" <phiho.hoang at rogers.com> is claimed by the authorities to have written:

> Tim Rowledge <tim at sumeru.stanford.edu> wrote:
> >
> > "PhiHo Hoang" <phiho.hoang at rogers.com> is claimed by the authorities 
> > to have written:
> > > 	I read through the missing chapters of the Blue Book but miss
> the 
> > > point why Interpreter is a subclass of ObjectMemory.
> >
> > It makes it simpler to generate the single interp.c file.
> 
> Anthony added:
> 
> > Since message sends in Interpreter and ObjectMemory are translated to
> C function calls, 
> > which does no receiver dispatching, the receiver always has to be
> self, hence the choice 
> > to make ObjectMemory a superclass.  
> 
> 	I am a bit confused. According to the NuBlue book:
> 
> 		anObject frobosinate
> 
> 	is translated to
> 
> 		frobosinate(anObject);
See TSendNode>emitCCodeOn:level:generator: which special cases 'self'
and 'interpreterProxy' to omit them.

If the receiver is anything else it gets added to the front of
the argument list. Thus
	self fooble.
gets turned into
	fooble();
whereas
	x fooble.
gets transformed to
	fooble(x);

If you want to make it behave any other way, feel free to try it out.
There area lot of possible improvements to Slang. 

tim
-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Don't diddle code to make it faster; find a better algorithm.




More information about the Squeak-dev mailing list