Kevin Smith wrote:
Would we? This is something a little different than "irrefutable
property get". Thinking...
Notice that, strictly speaking, we don't need an "irrefutable object"
operation:
let v = ?o.p;
// is equivalent to:
let v = {o}.?o.p;
The allocation in "{o}" can be statically optimized away.
The same goes for the pattern language:
let ?{ p: v } = o;
// is equivalent to:
let { ?o: { p: v } } = {o};
Sure, but that's crying out for a shorter form that avoids repeating o.
Note also that in the expression language, |o| might be a longer
expression (even, gasp, with embedded effects) that you would not want
to repeat.
Whatever we do for existential operators, destructuring in ES6 with
refutable-by-default patterns wants something at all levels, including
outermost -- or so I argue.
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss