This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Why not use private keyword instead of #? #8
Comments
See the FAQ for private fields. |
@bakkot why not prevent there from being a public field if a private field exists? |
@alexprice91 See the FAQ for private fields. |
|
@andy9775 We have heard that observation previously, yes. |
If the point is to avoid confusion with Java's |
See this FAQ entry for more details on why no prefix will make it work. For better or worse, it seems like we'll stay with |
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm sure you have taken this into account somehow, but I can't find discussion or reasoning for it in my research.
Why use the # prefix?
Why not use the private keyword?
I'd imagine you would use it somewhat like this:
Here we use the private keyword, both when defining the method, and when referencing the it.
As far as I can tell, this would solve the problem of having them being accessible on the instance of the class.
We already do something similar when referencing methods of a superclass, using the super keyword.
I find this to be more expressive, and more familiar.
The text was updated successfully, but these errors were encountered: