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

Kevin Smith khs4473 at gmail.com
Wed Jan 2 13:11:56 PST 2013


> You're right, this implies destructuring binding forms behave in a way
> that I flagged as possibly not wanted:
>
>   let {p?: {q: r}} = o;
>
> would bind r to undefined for any o that doesn't have a p or that does but
> o.p doesn't have a q.


So as Nil cascades downward, it essentially converts the whole subtree to a
"deeply" irrefutable pattern.


> On second look this is not as bad as I thought. It would be bad if r were
> not bound (so an outer r could become visible) depending on o's dynamics.
> That seems right out!


Yes, let's lobbest thy holy hand grenade at that one.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130102/e4ef1a22/attachment.html>


More information about the es-discuss mailing list