Boolean shortcuts

Mike Samuel mikesamuel at
Wed Jan 4 09:29:37 PST 2012

2012/1/4 Herby Vojčík <herby at>:
> Curse that eval-uation of a code block! This prevents not only this, but a
> lot of more possible enhancements/reforms!

I don't see the problem.  You are proposing a change to the
ObjectInitialiser production.  Francois's example just demonstrates
something we already know -- that there exist strings that will parse
as an ObjectInitialiser when you start in the Expression production
but parse as a Block when you start in the Program production.

eval('{ !window }') is and would remain a block, and eval('({ !window
})') with your proposal would be unambiguously an object initialiser,
and is a SyntaxError in ES5.

More information about the es-discuss mailing list