foo.bar().baz()
becomes foo bar baz
and if `bar` returns `self`/`this`, `baz` will be called on the same object. However, this has the issue that method implementors have to choose between fluent interfaces and returning useful values, as the fluency is decided by the return value domain for the method.Smalltalk sidesteps this by having an operator `;` which essentially means "the message after this operator is sent to the same object as the message before this operator". As a result, in the example above you could have `bar` returning the height of the empire state building, and you'd still get the exact same result by writing:
foo bar ; baz
(a message cascade returns the value returned by the last message)Smalltalk was/is not fond of literal syntaxes, so its collection APIs (as far as adding to them goes anyway) look a lot like Java's, yet you could write things in a terser manner by using cascading:
c := (ArrayList new) add: 3
; add: 4
; add: 5
; add: 6
; yourself.
is equivalent to: c := ArrayList new.
c add: 3.
c add: 4.
c add: 5.
c add: 6.
(note `yourself`, which does exactly what it says: it returns its `self`)(and yes I know you can combine Java's anonymous subclasses and instance initializers to get something similar, in the specific case of instantiating non-final collections).