tc39 / proposal-extractors

Extractors for ECMAScript
http://tc39.es/proposal-extractors/
MIT License
200 stars 3 forks source link

Array extractors can collide with assignments #7

Closed JLHwung closed 1 year ago

JLHwung commented 1 year ago

They are already valid JS:

// variable declaration + assignment
let Foo
(x) = y

// assignment + assignment
Foo
(x.z) = y

Here are some solutions for this issue:

1) forbid the line terminator between QualifiedName[?Yield, ?Await] and ExtractorArrayBindingPattern[?Yield, ?Await] 2) use other sigils for the array pattern, i.e. ||, ~[], etc. 3) innovate the syntax, i.e. let [x] with Foo = y, etc.

JLHwung commented 1 year ago

Sorry for the noise. I actually turned on error recovery mode and overlook the errors.