On Wed, Jan 2, 2013 at 1:13 PM, Brendan Eich <bren...@mozilla.com> wrote:

>
> Here I part company only on syntax:
>
>     r = o?.p.q       {p?: {q: r}} = o
>     P=o.p; Q=o?.q    {p: P, q?: Q} = o
>
> And of course, the short-hand works:
>
>     p=o.p; q=o?.q    {p, q?} = o
>

I love this. +1000.

As I've said previously, I think pattern matching would pair exceptionally
well with EcmaScript, and refutable destructuring is a great first step
towards that. After a little bit of use, I expect the community to demand
it, even if they aren't familiar with it in other languages.

"I want to destructure here, but I have a couple of possible options. If
only there was some kind of switch case with pattern matching..."

No chance of getting pattern matching in for ES6 by any chance, is there? ;)

- Russ


>
> /be
>
> ______________________________**_________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to