statements that could be expressions?

Peter Michaux petermichaux at gmail.com
Wed Jun 1 17:37:39 PDT 2011


On Wed, Jun 1, 2011 at 5:22 PM, Brendan Eich <brendan at mozilla.com> wrote:

> 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,

Such programs throw syntax errors when interpreted so presumably not
many exist where the program is of value.

> and possibly as a WTF teaching moment.

I can imagine this would be a mental change but ...

> 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

Completion reform is exactly what made me ask about this. If
expressions already become values and statements all have completion
values, could JavaScript more or less do away with statements and just
have expressions?

Peter


More information about the es-discuss mailing list