statements that could be expressions?

Brendan Eich brendan at
Wed Jun 1 17:22:47 PDT 2011

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

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

(note: in Harmony for


More information about the es-discuss mailing list