-
Notifications
You must be signed in to change notification settings - Fork 113
Support for ?. PrivateIdentifier
#302
Comments
Agree. I still find it kinda weird that ? automatically chains to further accesses, but given that it does, having |
I agree. Addressing this seems like the responsibility of whichever proposal landed second; since that’s this one, it seems like this proposal should adapt to include this case. |
I'd prefer to omit this support. I think considering it is the responsibility of the second proposal (i.e., this one), but I don't think the conclusion either way is determined. |
@littledan can you say why? It seems like a very natural thing to include, to me. |
Same to me. One common use case I have for private fields is static methods that take in possible instances to brand check; being able to use optional chaining on them ( |
And just for consistency, if |
My 2¢. If |
So, let me start by saying that my opposition here is weakly held. I'll explain here why my intuition is to exclude this feature, but I am happy to defer the result of the committee discussion. First, let's remember that the optional chaining proposal is deliberately minimal. Here, I think we have both issues:
All in all, when I write it out, those aren't such strong arguments. For this reason, I'm happy to go with the committee on this one. |
This was resolved in committee, and support was landed via #301. |
Continuing discussion from #301 (comment)
(Not related to timing of the PR, we can do either a followup on this proposal or a needs-consensus patch on ecma262. Either is fine with me.)
I see
foo?.#baz
support as being just another form offoo?.bar.#baz
. I think developers will end up being confused why they can do one syntax but not the other. Private field access feels like it is just part of the chain, no matter where that chain starts.The text was updated successfully, but these errors were encountered: