-
-
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
make Base.setindex() public #55129
base: master
Are you sure you want to change the base?
make Base.setindex() public #55129
Conversation
I'm missing the point of this PR, as far as I can tell this is already public:
|
Note the difference: julia> Base.ispublic(Base, :setindex!)
true
julia> Base.ispublic(Base, :setindex)
false |
Not sure what's the status here. Should I do some update of this PR or ...? |
If |
I'm not familiar with documentation generation, could use some pointers on where to update things :) |
This comment was marked as outdated.
This comment was marked as outdated.
If the function is to be made public, we'd need to decide if it's just for tuples, i.e, will adding methods for other collection types be allowed. Perhaps we could instead define something like Adding new methods would negatively affect abstract return type inference in the extreme case where the type of the input collection is unknown (inferred as |
(Removing my review request as @nsajko has got this handled 😉) |
Not sure what you exactly the issue with extending As the semantics of the function is pretty clear, and it's already extensively used in the wild (including new method definitions), what specific issues do you see with marking it
Tbh, I don't see a reason to do that. Defining separate functions for every type, instead of methods of the same functions, goes directly against Julia multiple dispatch design and practice. |
I'm referring to the "world splitting" optimization, see the EDIT: I only mentioned this issue for completeness. IMO it's secondary to proper documentation. |
@@ -151,6 +151,7 @@ Base.modifyproperty! | |||
Base.setpropertyonce! | |||
Base.propertynames | |||
Base.hasproperty | |||
Base.setindex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask, Is there a logic to this specific location, between hasproperty
and getfield
? Mostly just curious, I don't really have a better suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, perhaps the doc string would fit better into the Collections and Data Structures page? Under Indexable Collections I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Properties/fields and indices are kinda close conceptually, and they are exactly the same for tuples and namedtuples (the types setindex
is defined for). So it seems to make sense to put it here.
But any location works for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it can't go under "Indexable collections" as-is, because of the "fully implemented by" list in that section. The list includes types which don't implement setindex
...
FWIW, given that |
Still not sure how these considerations are relevant to marking Btw, a lot of high-performance code uses StaticArrays, and with them loaded one has at least 6 |
bump... |
bump :) |
bump... anything else I should do here? |
and another bump |
bump, anyone?.. |
should be a tiny change, any issues with it?.. |
setindex() is a widely used well-documented function, it should be marked public, right?
Not sure what's the right way to make a function with multiple methods public, please correct me if I'm wrong here!