Boolean shortcuts

Nadav Shesek nadav at shesek.info
Thu Jan 5 05:00:31 PST 2012


There was a suggestion for CoffeeScript, which got implemented by
Coco<http://satyr.github.com/cup/#c:%7B+enumerable,%20-configurable,%20+writable%7D>,
for `{+enumerable, -configurable, +writable}` syntax that does that. It has
the same potential ambiguity, but looks better IMO.

On Thu, Jan 5, 2012 at 9:29 AM, Herby Vojčík <herby at mailbox.sk> wrote:

> Hello,
>
> 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
> statements.
> 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,
>
>
> Herby
>
> -----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 mozilla.org
> Subject: Re: Boolean shortcuts
>
> 2012/1/4 Herby Vojčík <herby at mailbox.sk>:
>
>> 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.
> ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>



-- 
<me><name>Nadav Ivgi</name><profession>Software
Developer</profession><phone>+972-50-3650394</phone><blog>
http://www.shesek.info/</blog><timezone>GMT +2</timezone></me>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120105/58b167cd/attachment.html>


More information about the es-discuss mailing list