Squeak (ST80) syntax

Aran Lunzer aran at meme.hokudai.ac.jp
Wed Feb 16 13:15:41 UTC 2000


"David M.Siegel" wrote:
> I like a terminating keyword for cases where it improves readability.
> Seems to me, the problem is distinguishing a terminating keyword from
> a unary message. What if we made the terminating keyword required?
> That is, if it's part of the message, it's required.
> In other words, a sample selector might be #arg1:arg2:terminator.

I agree that think it could be helpful for readability.  One would have
to make sure, though, that it didn't disrupt the beautifully clean and
unambiguous parsing of Smalltalk [unary, binary, keyword] message
combinations.  At the moment, just by looking at a line of Smalltalk you
can figure out all the messages involved - for example, to go and find
them in a browser.

But using plain symbols as terminators might lead to an expression like:

   aStream read: inputHandle words.

Now, is "words" part of a message #read:words?  Or is it a unary message
being sent to inputHandle?  If we are also going to continue to allow
there to be a selector #read: on its own, even Smalltalk itself won't
know what to do!

And naturally one would still want to allow message arguments to be
expressions in their own right.  So how should the interpreter put
implicit parentheses on the following?

   aStream read: inputHandle upToCR words.

So there would have to be something special about a terminator that
marked it as such.  Hmmm...

   aStream read: inputHandle :upToCR.


[I remember about ten years ago reviewing a HyperTalk-like language in
which even the basic message library led to syntax examples where a
reader couldn't be sure whether a given token represented a variable or
a message.  I don't think that language got very far.]


Aran
-- 
Aran Lunzer                 aran at bigfoot.com
Meme Media Laboratory       lab: +81 11 706 7262 / fax 7808
Hokkaido University
Sapporo 060-8628, JAPAN     http://ca.meme.hokudai.ac.jp/people/aran/





More information about the Squeak-dev mailing list