Understanding Messages: Sequence and Cascade
Damien Cassou, Stéphane Ducasse and Luc Fabresse
http://stephane.ducasse.free.fr
Expression Sequence
.
is a separator
Example
Expression Sequence
.
is a separator, not a terminator
- no need to put one at the end
- no point after temporary variable declaration
Cascade: Sending Multiple Messages to an Object
is equivalent to:
Cascade Example
Sending Multiple Messages to an Object
is equivalent to:
add: 2
is sent to the receiver of message add: 1
- this receiver is the instance of
OrderedCollection
What You Should Know
.
is a separator
;
(cascade) is useful to avoid repeating the receiver
- the cascade returns the last message returned value
/