Eliminating assignments and variable syntax (accessors)

Jarvis, Robert P. Jarvisb at timken.com
Mon Aug 2 17:38:43 UTC 1999


I don't like the idea of implicit targets.  One of the great beauties of
Smalltalk is its simple and very regular grammar.  In my opinion adding
implicit targets would make the grammar more complex and less regular
without a corresponding gain in clarity or expressiveness.  I just don't see
a great advantage here.  It seems more like a hint to the compiler than an
aid to the human.  Also, if := is eliminated how is a reference assigned to
a temporary variable?  I suspect there's much here I'm not seeing...

Bob Jarvis
The Timken Company

> -----Original Message-----
> From:	Marcel Weiher [SMTP:marcel at system.de]
> Sent:	Monday, August 02, 1999 12:13 PM
> To:	squeak at cs.uiuc.edu
> Subject:	Eliminating assignments and variable syntax (accessors)
> 
> 
> I've been following the accessors thread with great interest and  
> have a rough sketch for eliminating direct variable access from  
> Squeak.
> 
> The basic idea is to replace the binding of names to variables with  
> messaging.
> 
> In order to accomplish this, the notion of messaging with implicit  
> targets and a lookup chain is introduced.  For example, messages to  
> self do not need to be prefixed with 'self'.
> 
> 	self hi.			-> 	hi.
> 	self hi:newHi.	->	hi:newHi.
> 
> Prepending 'thisContext' to the lookup chain for implied messages  
> brings arguments and local variables into the game, at least  
> conceptually (though of course a normal context won't respond to  
> these messages).  Appending an environment pointer might be used to  
> add namespaces and broadcasts.
> 
> Thus the syntactic overhead of accessors compared to direct access  
> would be eliminated by an implicit target for message sends.
> 
> The compiler can compile implicit message sends either as real  
> message sends or as direct variable access, depending on various  
> factors.  (This is deliberately vague).
> 
> I think this sketch addresses most of the issues raised on both  
> sides of the debate (and sounds suspiciously like SELF).  The syntax  
> is simplified and := can be removed.  Variables can be kept somewhat  
> private by not creating accessors for them.  Decisions to use direct  
> variable access are localized, not spread over all the code that  
> makes use of the variable.
> 
> Marcel





More information about the Squeak-dev mailing list