Background
In Smalltalk, if you don't excplicitly return anything then the message passing evaluates to the receiver (or "self" in the message context).
For example, given this method:
MyClass >> myMethod
Transcript show: 'hello'; cr.
Evaluating (doint "print-it") this:
| myInstance |
myInstance := MyClass new.
myInstance myMethod.
If <print-it> is done to the last invocation, then the result would be the instance itself.
Questions
- Why was this designed this way?
- What is the idea behind it?
- What was the philosophical background?
- What are the practical benefits from it? Is it to facilitate method chaining?