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

Russell Leggett russell.leggett at
Wed Jan 2 11:25:49 PST 2013

On Wed, Jan 2, 2013 at 1:13 PM, Brendan Eich <brendan at> 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 at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list