[self-interest] Re: Grammar changes - comments?

David Ungar David.Ungar at Eng.Sun.COM
Mon Aug 30 21:30:05 UTC 1999


It's great that you are thinking about this stuff.

Syntax is so subjective....
but here are my two cents:
the dollar-sign ($) has always seemed rather noisy to me.
I certainly understand the problem with the dot overloaded 3 ways
(statement end, floating point, and resending).

If I had to do it over again, I would probably keep the dot for resends and use
something else for statement boundaries--maybe a semicolon?


As far as cascades are concerned, in Self, we have a strong convention that
methods return self if they have nothing better to do.
Thus your example would be written

(pair clone key: key) value: value

I understand the attraction of the cascade--I guess it's a tough choice
between expressiveness and minimalism.
Personally, I would probably not put in cascades if I were to do it over again.

(I would put in nonlifo blocks, though).


- Dave


At 3:44 PM +0200 8/29/99, Stefan Matthias Aust wrote:
>Hi!
>
>For mySelf, I want to slightly change the Self grammar as follows...
>
>expression	= keywordMessage.
>keywordMessage= binaryMessage {keywordSend} | resend keywordSend.
>keywordSend	= smallKeyword keywordMessage {capKeyword keywordMessage}.
>binaryMessage = unaryMessage {binarySend} | resend binarySend.
>binarySend	= operator unaryMessage.
>unaryMessage	= receiver {unarySend} | resend unarySend.
>unarySend	= identifier.
>[...]
>resend	= [identifier] '$'.
>
>In contrast to Self, I use '$' to define delegation. Instead of "resend.x"
>you'd write "$x" now which is similiar to implicit self sends.  What do you
>all think about this?
>
>It's much easier to parse and removes the special treatment of the "."
>which had to be followed by no whitespace.  While you'd typically use no
>whitespaces with "$", you could do this if you want.
>
>
>Furthermore, I'm thinking about adding the ";" cascade operator from
>Smalltalk to mySelf.  I'm pretty new to actually code in Self, but
>
>  newPair: key Value: value = (
>    | pair |
>    pair: (| parent* = defaultBehavior. key. value |) clone.
>    pair key: key. pair value: value.
>    pair
>  )
>    
>looks ugly IMHO. I'd prefer
>
>  newPair: key Value: value = (
>    | pair = (| parent* = defaultBehavior. key. value |) |
>    pair clone key: key; value: value
>  )
>
>Comments?
>
>
>bye
>--
>Stefan Matthias Aust  //  Bevor wir fallen, fallen wir lieber auf.
>
>------------------------------------------------------------------------
>Get help getting gigs! Guru.com will make your freelance work more
>lucrative and more fun. Join us as we create the Internet's best resource
>for independent professionals. http://clickhere.egroups.com/click/804
>
>
>eGroups.com home: http://www.egroups.com/group/self-interest
>http://www.egroups.com - Simplifying group communications

 

     David Ungar
     Sun Microsystems Laboratories
     (650) 336-2618



More information about the Self-interest mailing list