-
Notifications
You must be signed in to change notification settings - Fork 113
The # is confusing. Should be private instead. #262
Comments
Please read the FAQ. |
I did and I still don't agree with the use of I agree that it would be harder to implement, but let's not just duct-tape features to JavaScript. Especially because it already has its fair share of that. |
That would violate the hard privacy requirement that the committee has set. Frankly, this issue has been discussed to death, and I highly doubt you're going to bring anything new to this argument, given that your argument so far is "I don't like it" and "it's not like other languages". The committee is aware, and they decided this was the best way forward. |
It has nothing to do with being harder or easier to implement. If you can observe the field from outside, it’s not private - so throwing on a string property is not acceptable. |
I see. Well, you're right. I tried my best and at least said something about it.
My argument isn't "I don't like it", my argument is pure readability and consistency. |
@danieldogeanu As one of the people who argued this into the ground, even I eventually ended up agreeing that Bottom line is that there is no logical reasoning behind their decisions in this matter. There is, however, rational reasoning backed by a particular emotional stance. Because of this, there is no reasonable approach to dissuade them from this course of action. It isn't that your perspective isn't shared by many, but rather that this perspective doesn't agree TC39's "concensus". They've decided that the issues important to those of us holding this view are not issues with as great a value as they ones they've considered. Or from your post, "pure readability and consistency" is not as important as the fallacious assumption that " |
@rdking I would be perfectly fine with using |
That wouldn’t allow for accessing private fields on other objects besides this, which is necessary for usage with instances in static methods. |
Like I said, many such options were tried and defeated:
There were many others as well, but the reasoning was mostly along these lines. |
The # is absolutely and definitively part of the name. |
@ljharb You may say so, but the proposal's author (@bakkot) disagrees with you, or at least he did when I last discussed the issue with him. If that has changed since then, I can accept that. If not, then by your own words, you are incorrect since (as you previously told me) the intention of the elements of the proposal are up to the proposal's author. |
The proposal has many authors, but fair enough. |
I'm not really sure what you're talking about. I refused to classify it as "part of the [[IdentifierName]]", because IdentifierName is a specific production in the grammar which does not include |
Am I not correct in saying that at least at present (prior to class-fields reaching stage 4), all variable and property names in ES are classified as an Can you see how this begs the question of what |
To all TC39 members reading the above post: Leaving such an unclear element like whether or not |
As was said in the linked thread, it’s a brand new thing. It’s also a thing hardly any other languages have. The # is part of the name, it’s not part of an IdentifierName, and it’s accessed only with dot. This has nothing to do with unspecified behavior; it seems like you’re talking about mental models? |
The spec is unambiguous, in part because it is not defined in terms of things like "what is part of the name of a field" (unless it has given explicit, unambiguous definitions to each of those words). And this proposal introduces no new implementation-defined behavior (meanwhile, elsewhere we are working on cutting down on such behavior where it currently exists). I don't think there is much risk of that here. Also, I don't know what "Symbol is an [[IdentifierName]]" means. IdentifierName is a grammar production; Symbols are ECMAScript language values. That comparison is a category error. Anyway, this is pretty off topic. If you want to keep discussing this, please make another issue or open a thread on the discourse.
Please don't do this. No one is deliberately ignoring anything. We have a disagreement about terminology. |
Maybe "disregard" would have been a better choice than "ignore". As I've said before, TC39 gets full marks on at least trying to cover all the bases. In either case, since I often cross terminology in ways that should not be done, I'm going to pour through the spec 1 more time to make sure that what I say in discourse carries the intended meanings. |
Thanks for your feedback. |
Can I make the case against using the
#
sign to denote private fields?Since the language is also getting a
static
keyword, it would be consistent to also get aprivate
keyword for private fields. The#
sign just makes the language a lot more confusing than it already is.Using the
private
keyword will also make it consistent with other C-like languages and it would be easier for developers to use it.I don't have a problem with the private fields per se, but I consider things should be a little more readable. The
#
sign is not readable at all.Please take this into consideration. Thanks.
The text was updated successfully, but these errors were encountered: