fail-fast object destructuring (don't add more slop to sloppy mode)

Kevin Smith khs4473 at gmail.com
Sun Jan 6 03:39:02 PST 2013


> I raised this problem-case, so I want to point out that we could take
> other courses:
>
> * Reckon that labels are rare and this won't bite, so let it stand, just as
>
> a = b
> (c)
>
> is a hazard today -- and one that bites much more.
>
> * Don't allow suffix-? to be followed by a newline.


Leaving aside ASI for a moment, there are other issues:

    let v = obj?+(0+1+2+3+4+5+6+7+8+9+...+n):null;

We don't know whether this is a conditional expression or not until we get
to the ":" an arbitrary distance away from the "?".  We might be able to
use another cover grammar approach here, but is it worth it?


>
> You must have meant (2).
>

Yep!


>
> Apart from deviating from the cowpath (CoffeeScript), prefix-? is
> equivalent to suffix-? as I argued in reply to Herby. We'd want to support
>
>   let ?{p: v} = o;
>   let v = ?o.p;
>
> to handle the case of undefined or null 'o', of course, in which case v
> would be initialized to undefined.
>

Would we?  This is something a little different than "irrefutable property
get".  Thinking...

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130106/c838f290/attachment.html>


More information about the es-discuss mailing list