On Thursday, 23 July 2015 at 13:30:49 UTC, Andrei Alexandrescu
wrote:
I used to be quite jazzed about the everything-is-an-expression
mantra, but it's not all great.
1. Inferring function return types when everything is an
expression (i.e. last expression there is the return type) may
yield WAT results.
2. Defining a result type for loops is awkward.
At the end of the day everything-is-an-expression is natural
for functional languages, but doesn't seem it makes a large
difference to an imperative language.
It also works well for Ruby with its dynamic typing. Function
return types don't matter, of course, and for loops you just use
whatever the last executed expression happens to be.
Anyway, in D we have delegate literals, for the rare cases where
it's useful.