Boolean shortcuts

Herby Vojčík herby at
Wed Jan 4 23:29:31 PST 2012


sorry that I did not get it from the beginning.
You are right.
I am really concerned about use of boolean shortcuts in the context of 
object initializer.
But François's examples scared me.
Especially the impossibility of `{ !window }.callFunc();` kind of 
But in such case, early error should tell me I am in the wrong way and 
people are accepting that this kind of construct need parentheses to 
disambiguate (especially for the ({}).foo case).

So I would make the proposal alive again, but the thread got cluttered. :-/

Thanks again for showing me not to panic,


-----Pôvodná správa----- 
From: Mike Samuel
Sent: Wednesday, January 04, 2012 6:29 PM
To: Herby Vojčík
Cc: François REMY ; es-discuss at
Subject: Re: Boolean shortcuts

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