Squeak (ST80) syntax

David M.Siegel dsiegel at mindspring.com
Wed Feb 16 13:40:36 UTC 2000



Aran Lunzer wrote:

> "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.

I agree that interpretation must be unambiguous.

The correct interpretation seems to be to have terminators associate
rightmost,
with greater precedence than unary messages, so:

    aStream read: (inputHandle upToCR) words.

but:

    aStream read: inputHandle words.

is a send of #read:words.

The parser should follow the usual rule that the maximal expression is
parsed.
The programmer could type

    aStream read: (inputHandle words).

> So there would have to be something special about a terminator that
> marked it as such.  Hmmm...
>
>    aStream read: inputHandle :upToCR.

I'm not convinced that terminators need to be marked, though it would
certainly
simplify parsing.

It does seem, though, that current Smalltalk programmers would have to
get accustomed to unmarked terminators, and the simplicity of the syntax is
somewhat impaired.  While the rules I suggested above are unambiguous,
they're
not as obvious as the current rules.

-dms





More information about the Squeak-dev mailing list