-
Notifications
You must be signed in to change notification settings - Fork 703
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
Explain why Dart uses '_' for privacy rather than a keyword in the documentation. #2671
Comments
I don't think the language tour should justify or provide history, but it seems legit to link out to justifications (such as dart-lang/sdk#33383, in this case). Maybe a note like this:
What do you think, @kfish610? EDITED to change annotations to access modifiers. |
That sounds reasonable, though I think they're called access modifiers, not annotations. Other than that, seems well worded, definitely would have made me much less confused than I was when I read the tour originally. |
Oops, yep, you're right about using access modifiers. |
@kfish610 would you like to make this fix, or shall we open it up to the community? |
I can make it, is there anything I need to do other than make a pull request? |
Thanks! Just make a pull request. Search for "Deprecation note" to find some code to copy. (I don't see any other "Language note"s, but it makes sense to me to have a separate note type for this.) |
@kwalrath Out of curiosity, is there a reason you prefer saying "Language note" as opposed to just "Note"? All of the notes on the tour just say "Note", and most of them refer to the language. |
You're not wrong. I was thinking that a "Language note" might imply a comparison to other languages, but perhaps that's too subtle a point. |
Coming from C#, I was incredibly confused why Dart chose to use a prefix of
_
for private variables, rather than the typicalpublic
,private
, andprotected
modifiers. After reading through dart-lang/sdk#33383, however, I understand why Dart chose this method of visibility modification, and I don't mind it as much. However, it seems strange to me that no where in the docs does it even reference an explanation (unless I missed something, and if I did, please let me know). I think adding a section somewhere in the docs to explain the underscore notation (maybe a note in the tour?) would make people less likely to immediately discount Dart based off of this choice (I know I did, and looking at that issue, so did a lot of people).Any opinions?
The text was updated successfully, but these errors were encountered: