fail-fast object destructuring
brendan at mozilla.org
Wed Jul 11 10:06:51 PDT 2012
Russell Leggett wrote:
> Russell asked about 'length' -- per a previous thread, I thought
> we agreed that one [[Get]] of 'length' would be done before
> matching if and only if the array literal contains a spread
> (covering rest, the dual for a pattern of spread in the array
> literal corresponding to the pattern).
> Yes, I saw this in the proposal algorithm. The reason I ask is because
> it seems odd to have an additional structural requirement in some
> cases but not others. Of course, I understand why, but it sort of
> makes it look like  implies additional array-like structure in one
> case, but not in another.
You get what you ask for. Pay as you go. Buy by the yard.
Ok, out of clichés but I hope we aren't going to revisit and impose a
mandatory [[Get]] of 'length' on all array destructuring forms. That is
otiose and costly (potentially very).
The presence of ...rest is static syntax, so there's no runtime
More information about the es-discuss