Naive questions on cascade syntaxe

ducasse ducasse at iam.unibe.ch
Sat Dec 29 20:56:43 UTC 2001


Hi

I'm trying to come to the simplest set of rules to put () around Smalltalk
expressions. I'm on the cascade.

is it correct to say that a cascade is
   - either without () I mean outside of the cascade
    this happens when there is no message send to the cascaded expressions
    itself like in x := Set new add: 5 ; yourself
    
   - either there is one message not in the cascade and the cascade should
be parenthesised.
    like in 
        (x := Set new add: 5 ; yourself) class
    or  (Set new add: 5 ; yourself) + 2
    or  (Set new add: 5 ; yourself) includes: 5

I read the ANSI standard but could not really found a clear description.

Then inside the cascade you need () only if the receiver expression selector
is a keyword and that you have keyword in the messages

    examples: 
        Set new add: 5 ; add: 5 ; yourself (the formatter of VisualWorks put
() around Set new but I guess that this is just to stress the receiver).
        Set new reset; reset ; reset
        with binary I do not see what example would not be silly
        (Set with: 5) add: 6 ; yourself

    





More information about the Squeak-dev mailing list