destructuring: as patterns?

Andreas Rossberg rossberg at google.com
Mon Apr 23 02:40:00 PDT 2012


On 21 April 2012 11:56, Herby Vojčík <herby at mailbox.sk> wrote:
> Andreas Rossberg wrote:
>> Of course, it is absolutely true that the same argument can be made
>> about someExpression.x, but I file that under historic legacy. If we
>> were to design JS from scratch -- and with the ES6 feature set! --
>> then I'd surely vote for making that throw as well (like, btw, I would
>> for argument arity mismatches in function calls, if the callee doesn't
>> have appropriate default or rest parameters). Clearly, it's not
>> possible to correct that, but why should that imply that all new
>> features need to inherit sloppy semantics, too?
>
> I disagree. Borrowing from Alan Kay IIRC, this is like making an octopus
> from a dog by nailing more legs on it - that is, these two points of view
> are incompatible.

Well, that already is the case. ES5 added strict mode. With 1JS in
ES6, the rules may get more fuzzy. You gonna have 'let' vs 'var'. You
gonna have '=>' vs 'function'. You gonna have 'for-of' vs 'for-in'.
All additions that fit your description. It's not pretty, but bolting
on new legs next to the old ones is the only way to keep a language
like JS moving forward.


> JS model _is_ about "sloppy semantics" (I do not call it sloopy, I'd rather
> called it liberal), that is, undefined if not present.

It's a term sometimes used on TC39, I didn't invent it (I used to call
it "classic" mode for improved neutrality).

I may take issues with associating pre-strict-mode sweeping under the
rug with liberal ideals, though. :)

/Andreas


More information about the es-discuss mailing list