We were discussing the function call ambiguity aspect upthread: interestingly there's something in the compiler (if not in the grammar?) that prevents ()
or []
from being treated a function call / subscript if at least the opening (
or [
is not on the same line as the preceding expression, so that's no issue. We just haven't considered then the "compulsoriness" aspect (using ()
even if it's otherwise not needed to resolve the ambiguity, but as an "expression value" marker).
Yes. It is meant to solve the issue often brought up against using the bare last expression - makes it easier to spot them.
BTW, if to use the last expression rule (bare or "dressed up") it is now obvious to me that it must not be done in the multi statement functions/closures (e.g. for the sake of consistency). The reasoning is the same as the reasoning not to use "return" to mean expression values. Whatever we choose, retuning a value from a function closure should be visually different to "expression statement" value (this is broken for the single-statement but let's not break it further in the multi-statement case). "Option 5" rules.