Squeak (ST80) syntax

Torge Husfeldt jean-jaques.gelee at gmx.de
Thu Feb 17 11:27:23 UTC 2000


SyntacticHi!
> > -----Original Message-----
> > From:	Tim Rowledge [SMTP:tim at sumeru.stanford.edu]
> > Sent:	Wednesday, February 16, 2000 2:36 PM
> > To:	squeak at cs.uiuc.edu
> > Subject:	Re: Squeak (ST80) syntax
> > 
> > I very strongly like the syntax as it is.
> > 
> Your posts have always indicated that you were an individual of taste
> and
> intelligence.  This confirms it.  :-)
I second this.
> 
> > The only thing I've ever found
> > that irritates is the lack of some way to do 'super-super' message
> > sending. You must have hit the situation where you really want to
> > inherit the method from a couple of classes up but an intermediate
> class
> > has overridden? grr.
> > 
> Interesting, isn't it, that "super" is a keyword and not a message?  And
> that it causes problems such as this?  To quote from the book of Dan
> (a.k.a.
> "Design Principles Behind Smalltalk")
> 
> 	Good Design: A system should be built with a minimum set of
> unchangeable parts; those parts should be as general as possible; and
> all
> parts of the system should be held in a uniform framework.
Yes, don't add any unnessesary keywords to smalltalk. And first of all
don't make smalltalk look more like some other language. You may want to write
a GNALS preprocessor or cross-compiler (SLANG backwards if you didn't
notice) and even seamlessly integrate it into some paragraph editor or the other.
> 
> "super" is one of those unchangeable parts - because it isn't a message
> we
> can't change what it does, nor do multiple repeated sends (e.g. "super
> super").  It's "outside the system", in a sense.  Unfortunately the only
> fix
> I can see to this is to provide a way to specify the message lookup
> context
> (for lack of the correct term) for each message, or perhaps to add a
> bytecode which tells the VM to "move up" one superclass level in the
> lookup
> hierarchy so that "super super" would mean "look up the next message
> starting in the method dictionary of my superclasses superclass".  Of
> course, this still leaves it as a keyword instead of a message.  :-(
Note that super as it is now only works because it is a keyword. Otherwise
you would have to fiddle around much with contexts. As I understand it now,
in squeak super is implemented as a messages send with the initial lookup
class set to the superclass of the implementation class (not the superclass
of the receiver class as maybe in some other smalltalk dialect). There is a
simple test where the latter would lead to an unwanted recusion, I think this
is mentioned somewhere in smallint.
The solution would be to make greater use of the message send as a first
class object (which already exist but is used only for error reporting).
These obejcts know the initial lookup class in an instance variable and so
instead of writing:
super new initialize
You could write
(Message new
	receiver: self
	selector: #new
	arguments:#()
	lookup: <my superclass>) sendIt
(Implementors superclass)
(Message new
	receiver: self
	selector: #new
	arguments:#()
	lookup: self class superclass) sendIt
(Receivers superclass)
This would be more flexible and would do what you want.
This could even completely replace the #perform: thingy (I think
perfomANCE should be comparable).
superBy,
Torge

-- 
Sent through Global Message Exchange - http://www.gmx.net





More information about the Squeak-dev mailing list