I didn't go with ...= because it looks weird and has too many characters.
Is it worth adding to the language? I mean it just provides a quality of life improvement nothing too groundbreaking. What do you think ?
Those two cases are mutually incompatible: the first one uses the iteration protocol, the second one uses enumeration of object properties. A random value may be both iterable and have properties, so there is no way to disambiguate reliably the two cases.
All assignment operators are in the form "X=", where X is an operator, and X= is the assignment operator form of it. For an assignment operator to exist, a non-assignment one likely should too.
It could be ...= which would comply with this norm but isn't concise enough to be used as an assignment operator in my opinion so I shortened it to just .=
Shorthand assignment operators follow the rule that
x += y; β x = x + y;
x -= y; β x = x - y;
x *= y; β x = x * y;
x /= y; β x = x / y;
x ||= y; β x = x || y;
x &&= y; β x = x && y;
x ??= y; β x = x ?? y;
Is that a rule or a norm? I just think that it's a handy little syntactic sugar
Well if there exists such a rule that specifically focus on the syntax alone then: x != y; β x = x ! y; isn't much different from x .= y; β x = x . y;
There exists a four character operator >>>= so ...= could be another pick instead.
Rest and spread syntax (and semantics), though, isn't an operator, and doesn't have a LHS and/or RHS, so it wouldn't make sense as an assignment operator.
Not sure I understand the distinction between a rule and a norm. != or == are not shorthand assignment operators though, they are no covered by this convention.
The point is that x ...= y doesn't make sense, as x = x ... y is not valid syntax. There is no such ... operator, so there wouldn't be a ...= shorthand assignment operator either.
Why does it have be that there needs an infix operator X for there to be an X= operator? I'm asking how is that a rule? Is it in the Spec? Who established such a rule? A norm is kind of like an unspoken / unwritten rule. I think this argument falls under one such case.
Because thatβs what the entire history of the language primes everyone to expect. Violating that would be surprising and confusing, although of course we could do it - so, we almost certainly wont.