[squeak-dev] implicit values (was "The Inbox: Tools-LM.828.mcz")

Chris Muller asqueaker at gmail.com
Tue Aug 14 21:32:56 UTC 2018


I'm obviously very interested in this subject...

>> ...I would like to hear someone else's stance on it however.
>      I also think everyone should know that ([] value) is nil, so
> writing "ifAbsent: []" is fine. But I wouldn't mind an explicit
> expression inside those brackets, either, even if that expression is
> "nil". No one's legitimacy is at stake in either case. A comment to
> explain what that nil will signify later could be useful in some situations.
>      In contrast, seeing someone write "^self" at the end of every
> method that answers self (at least, without a comment to explain any
> subtlety there may be) would drive me insane. :)

Ah, but the question being asked is the opposite.  i.e., should
String>>#asString remain as:

    ^ self

?   Or, changed to an empty method (to rely on implicit "return self")?

According to me and Kent Beck's "Interesting Return Value" pattern, it
absolutely should be explicit.  Removing it would not be a good way to
promote "literacy".

I believe Squeak can go so much further when
intelligent-but-illiterate people can read the code.  Syntactic
literacy will come quickly and naturally to those who can maintain
enough interest to stay past their first day, but those little details
won't carry them very far compared to being able to read the code with
little effort.


More information about the Squeak-dev mailing list