On Jun 1, 2011, at 5:16 PM, Mike Samuel wrote:

> The semantics of all of these are specified in terms of expression
> semantics.  Every statement or expression is specified in terms of a
> triple of (one of (normal, throw, break, continue), value, label).

Alas, only statements have Completion results. Expressions are modeled as 
having normal completion with a value, and there's a bit of a gap in the spec 
where a thrown exception unwinds from within an expression to the statement 
layer.

For a deferred proposal to allow statements to be turned into expresisons 
explicitly, see

http://wiki.ecmascript.org/doku.php?id=strawman:let_expressions

Implicitly treating statements in expression context as expressions could be 
done but I think it smells bad on account of turning erronous programs into 
working programs, and possibly as a WTF teaching moment. These may not be fatal 
objections, though. TC39 has not really considered making statements into 
expressions.

See also

http://wiki.ecmascript.org/doku.php?id=harmony:completion_reform

(note: in Harmony for ES.next).

/be

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to