Brendan Eich wrote:
Dave suggested making the first case, let {x} = {}, throw, and
requiring ? as a pattern modifier (I suggested prefix):
let {?x} = {}; // x is undefined, no throw
let {y} = {}; // throw
I forgot to mention something Dave noticed. Should
let {?x:{y}} = {};
This too would not throw, rather it would bind y to undefined -- unlike
the get-undefined-and-then-fail-trying-to-get-y-from-it approach of
destructuring as implemented in SpiderMonkey and Rhino (based on ES4,
then ES6 drafts).
So ? as pattern prefix is a deep opt-in flag. Thoughts?
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss