-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why -> is any better than .# #19
Comments
This seems like a really core part of the argument. Why do you think On the other hand, the private fields and methods proposals have been designed to be basically parallel to public properties in their semantics, and make this mental model that they are related practical for writing code. |
I don't think the actual semantics of the C -> operator is very relevant. But, to turn your question around. Why would a JS programmer have an intuition that |
You are right, the semantics of the C/C++ |
I don't think there's a terribly high risk of confusion over which operator to use, once the rule is learned ("for hidden things use @allenwb Another option which I didn't think about before is Here are the examples, written with |
I think that However, won't the proponents of the bind operator proposal 😜 get pissed off if we try to take |
Are there any of those left out there? I think the chaining aspect of that proposal (which was always a little sketchy) has been overtaken by We need a solution for method extraction (probably some kind of a unary operator), but I don't think |
JS programmers include those who know C and C++. If this proposal uses An observation regarding item 2 in the list for this issue: This could solve the "dot is for property" objection (item 3). I wanted to record it so we discuss and avoid overlooking a path that does not proceed down the dot-means-property path based on the assumption (choice) of |
Or However, I still think that |
What are other |
There is some experimentation going on with the pipeline proposal, where tc39/proposal-pipeline-operator#100 But I also worry about any usage of |
I think the reaction to |
I wasn't thinking about any specific proposal for |
Lol, I should have remembered, as I was the one who proposed Ok, I agree: |
From a grammar standpoint, I don't think we have to worry about # being "claimed"--there'd be no ambiguity about supporting both private field shorthand and frozen object/method syntax since you can't begin a name with I don't think there'd be ambiguity if we supported It's true that the combination of these things would make Anyway, if the big issue is the syntax, that maybe the community would find I don't know if I really buy the hypothesis that avoiding the |
Probably not, if fields are kept as the starting point. As I argue over in #21 , when fields are taken as the starting point, you naturally end up with "private fields" and "private methods" which introduce many of the problems that this proposal attempts to avoid (including the need for leading-sigil names). |
Right, we aren't just trying to fix the |
Closing in preparation for public review. Please feel free to continue discussion or open a new issue for a specific topic. |
Would such confusion be an actual issue? Do you have an example of something that might not work as expected for a JS developer? Also, IMHO I don't have any data on this but another potential downside is that we'll now have to remember if the property we're trying to access is private or public and use the corresponding operator. An issue |
Why programmers want to try
If this is your only concern, what do you think about
Unfortunately programmers never think
This is a minor ergonomics problem of writing code, I don't think it's a big deal, and autocompletion also apply here -- when you enter |
Sorry for jumping in late; I didn't see this repository before it was made public. Most of my programming experience is with Ruby, JavaScript (with some TypeScript) and Rust, so I personally don't have a visceral feel for the That said, as @littledan suggested,
More specifically, |
We always have to choose one syntax... from this not long 😉 list:
Which one (or two) do you prefer? |
From a purely technical perspective , Even if we defined One of our reasons for choosing an operator that doesn't include A symbol that implies containment is nice, but is unlikely to be universally recognized as such. Ultimately, people have to learn the semantics of these special forms, and intuition is only going to carry them so far. |
@allenwb can you point me to a corpus of pushback that reflects that fear? I've seen, almost universally, a simple dislike of the "#" because it's "ugly". I also don't think that regular developers have a strong sense of "how many tokens are in a sequence" or "somethingfix operator". |
@ljharb But |
In response to @BrendanEich #17 (comment)
#
as a private name prefix..#
is not a single token but is the.
operator followed by a#
prefixed identifier. The implication is that.
is the primary operator..
is not appropriate because the semantics of referencing a hidden name (as defined in this proposal) are not the semantics of property lookup. This will likely lead to more conceptual confusion about the nature of instance variable, hidden methods, and properties.->
is an available character combination that carries along a referencing implication from C/C++...
. It may be perceived as similar, but different to the.
operator. There are both positive and negative conceptual implications of that similarity.->
reads better (stands out more). See the example at the start of AWB alternative proposal sketch #1 #5.The text was updated successfully, but these errors were encountered: