-
Notifications
You must be signed in to change notification settings - Fork 23
coordinate operator choice with optional-chaining proposal #9
Comments
If both the null guard and null coalesce are introduced in the same ECMAScript version, I vote for the couple If for some reason one is more useful than the other and the other is being pushed back to another version, I'd say keep |
There's a growing preference for using |
@gisenberg would you mind changing the repo/proposal so that it covers both nullary-coalescing and nullary-guard? |
We shouldn't add things just to fill in a table; what are the use cases for "guard"? |
discuss in #4 |
In the interest of keeping proposals as small as possible (addressing "I don't want to commit to X if I only want Y"), I think that null guard would be best served in an independent proposal. I'm currently championing both proposals, so the coordination tax is easy to manage. Unfortunately, the syntax choices in one proposal impact the other that makes it hard to present, as reviewers can't reason about the proposals independently when syntax is intertwined. This proposal + optional chaining will likely be merged in the near future. |
I am personally somewhat skeptical about the pertinence of merging, because the syntax is the only interdependent issue. Otherwise, the two proposals have each their distinctive issues and challenges (e.g., precedence for nullish-coalescing, short-circuiting for optional-chaining). |
@claudepache They have different concerns, but they are related enough that I don't think I can advance among the committee unless they are presented in the context of each other. For example, there's general support for |
Whether or not two proposals merged, these operators should be landed together. And it seems there are not much semantic issues left in both proposals. The only big issues are syntax and operator precedences. |
What "distinct token" mean? Does that mean |
@hax Sorry, "distinct" was the wrong word to use there. What I meant was, there was general support for |
@gisenberg I just confused, if use |
@hax Your understanding is correct. If optional chaining is using |
@gisenberg So I guess the situation in the meeting is, attendees think |
@hax That is correct. |
@gisenberg Oops, we are just go back to the original point... This is really a tough work for you! |
@hax Yep! I sent an email your way if you're interested in discussing further. |
@gisenberg Yes, I always glad to give a help for JavaScript community! |
Closing, since this proposal is at stage 4, and the operators were indeed coordinated. |
Over in the optional-chaining proposal, there's been some discussion around how to accommodate the full set of possible/proposed shorthand operators for truthy-falsy and nullish behaviors. (link)
Copying a relevant table from over there:
truthy
/falsy
nullish
x ? x : y
x || y
x ?| y
(alt:x |? y
)x ? y : x
x && y
x ?& y
(alt:x &? y
)x ? x.y : x
x??.y
Any opinions? All of these operations inhabit an adjacent space, so there should be some coordination in order to avoid multiple conflicting designs.
The text was updated successfully, but these errors were encountered: