fail-fast object destructuring

Andreas Rossberg rossberg at google.com
Wed Jul 11 04:14:14 PDT 2012


On 10 July 2012 10:17, Russell Leggett <russell.leggett at gmail.com> wrote:

> Yes, I think that arrays are likely the strongest case for ? on bindings.
> Something like this would be nice:
>     let [first,last,?company] = contact.split(",");
>

Actually, I don't see how this is a case of "? on bindings". In fact, the
'?' would have to be interpreted as part of the array pattern syntax for
the above to make sense (in analogy to object patterns, it happens to be
associated with the implicit property name "2").

AFAICS, '?' on a variable itself would always be redundant, because a
variable pattern is irrefutable anyway.

/Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120711/de679971/attachment.html>


More information about the es-discuss mailing list