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.
Using the "." for resends was a very unfortunate decision, and your idea to replace it with "$" is a good one. I had suggested using "::" since several other languages already use that for similar purposes and Java (and Beta, in a negative way) showed how important it is to have familiar elements in the syntax.
About the cascades, you would need a "dup" bytecode (but since you already were going to add it anyway this is no big deal). I have never missed it when programming in Self, however.
-- Jecel
Using the "." for resends was a very unfortunate decision, and your idea to replace it with "$" is a good one. I had suggested using "::"
I know. Perhaps it's a matter of personal taste.
printString = (parent::printString + '()') -vs- printString = (parent$printString + '()')
IMHO, the first variant looks more like an assignment. Furthermore, I'd like to reserve :: to introduce emtpy keywords. They might to turn out to be useful. I don't know. What an empty keyword is? Look at this...
object fooBar: 'hi' : 12 : whatever.
currently, one would have to write
object fooBar: 'hi' _: 12 _: whatever.
since several other languages already use that for similar purposes and Java (and Beta, in a negative way) showed how important it is to have familiar elements in the syntax.
Which is a very valid argument to consider... But as Self already looks very strange to the masses I don't think that using "::" would make a big difference :-)
bye -- Stefan Matthias Aust // Bevor wir fallen, fallen wir lieber auf.
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
self-interest@lists.selflanguage.org