On 11 November 2011 12:48, François REMY <fremycompany_...@yahoo.fr> wrote:
> I think you strongly underestimate the "distinction" problem. It's *not*
> possible to make any difference between the "foo" statement and the "print"
> statement of your sample, from the compiler point of view. Why would the
> "foo" statement be the one chosen as a return value for the "if" block? It's
> completelty unclear to me.

JavaScript already has the notion of "completion value" of a statement
sequence, which defines exactly that. It is used to determine the
result of eval calls. Unfortunately, the completion value is currently
determined dynamically, but there is a proposal for correcting that
behaviour, see 
<http://wiki.ecmascript.org/doku.php?id=harmony:completion_reform>.

Using this to define implicit return values of blocks or functions was
one idea behind that proposal. Effectively, this just generalizes the
comma operator (which is redundant in the same way ?: is).

/Andreas
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to