Closed robpalme closed 4 years ago
One possibility is the fact that &&= and ||= are missing is a source of complexity, and adding these operators might instead reduce the complexity budget.
Every time I have to put a value into an object, I'm super annoyed that I have to repeat the obj.foo
. I think the proposal has minimal syntax complexity, but may cause confusion due to the short-circuiting semantics.
But, setters in general are still super rare, so the majority of cases won't matter at all. And where they are common (mainly DOM APIs?), having short-circuiting semantics is actually desired.
@rdsedmundo this repo is for logical assignment; opinions on other syntax are irrelevant here.
You're saying that you understand what &&
, ||
, and ??
do; and you understand what +=
and friends do in comparison to +
, but you had trouble understanding what &&=
, ||=
, and ??=
do? Please elaborate; I'd love to understand your confusion here.
My first impression when i saw this in chromestatus was whata heck is this new weird complex stuff? 😳 never seen it before
looked at the example and i knew what it was, honestly I'm more annoyed by the new syntax that gets added all the time. javascript have become a fatigue. I have long waiting for the day for when i no longer need babel to transpile my code. Or when i forcefully need to update my engine to work with new tools. or having to downgrade my code cuz something don't work in xyz.
can't browser just focus more on
Apologies I forgot this issue was still open.
We've seen plenty of use-cases and the outcome was that the committee does believe this feature is worthwhile. Thanks to everyone who contributed to this thread!
Logical operators in JavaScript have unexpected behavior (short-circuiting) compared to other languages that return a boolean. Given the long list of proposed syntax additions competing for the complexity budget, is it worth spending it on yet another way to surface this somewhat odd behavior? My feeling is no, but I would like to hear more from other reviewers.
(This was the general feeling that came out of a company-internal discussion between a bunch of us reviewing forthcoming proposals.)