-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Change Dict
field names to _keys
and _vals
#49095
Comments
This will break a lot of code out there. Does not seem worth the churn. |
do you have an example of someone using this outside of base? |
This sounds like something a linter might warn against |
The number of packages that uses internal data is quite large. Some of them extends the |
https://discourse.julialang.org/t/dictionary-showing-invalid-keys/96422/1 Does this mean, however, that all non-public fields should now have a leading underscore? Otherwise, this becomes inconsistent and confusing. |
No, there is no such proscription. As always, fields can be named anything we want. I don't think renaming two fields is a cause for confusion.
It's unfortunate that we can't make non-breaking changes in Base without breaking things. |
Yes, a pragmatic view always has to be taken. But you could try open a PR, run PkgEval, see the level of breakage and maybe fix those packages etc. |
What I meant is this: If one starts prepending underscores to signal that some fields are internal, what does that say about the fields that do not have leading underscores? This should either be a convention to be followed more generally, or it risks encouraging people to access internal fields in some cases. |
To avoid new users accidentally accessing the internals of a dictionary via
d.keys
ord.vals
(e.g., if they're coming from an OOP language), it's probably a good idea to change the names of those fields to_keys
and_vals
.Inspired by this question on Discourse:
https://discourse.julialang.org/t/dictionary-showing-invalid-keys/96422
The text was updated successfully, but these errors were encountered: