improve effects of objectid and getindex(::Dict)#49447
Merged
aviatesk merged 11 commits intoJuliaLang:masterfrom Apr 25, 2023
Merged
improve effects of objectid and getindex(::Dict)#49447aviatesk merged 11 commits intoJuliaLang:masterfrom
objectid and getindex(::Dict)#49447aviatesk merged 11 commits intoJuliaLang:masterfrom
Conversation
Seelengrab
reviewed
Apr 20, 2023
vchuravy
reviewed
Apr 20, 2023
vchuravy
reviewed
Apr 20, 2023
aviatesk
requested changes
Apr 21, 2023
Member
aviatesk
left a comment
There was a problem hiding this comment.
Add a test case that exercises the improved effects.
Member
Author
|
tests added. |
KristofferC
reviewed
Apr 21, 2023
base/reflection.jl
Outdated
| function objectid(x) | ||
| # objectid is foldable iff it isn't a pointer. | ||
| # Sring, Symbol, Module, and DataType are safe because jl_objectid for them works by value. | ||
| if !ismutable(x) || x isa String || x isa Symbol || x isa Module |
Member
There was a problem hiding this comment.
ismutable doesn't feel right.
Consider
struct F
v::Vector
end
That's not mutable but I don't think objectid is foldable for it.
Member
There was a problem hiding this comment.
Module I think also gets different objectid in different sessions?
Member
Author
There was a problem hiding this comment.
Module is hashed by name and parent name as of #47749. Good catch on F. I think the right test is valid type param
Member
|
Build on aarch64-darwin is failing likely due to a |
KristofferC
reviewed
Apr 21, 2023
aviatesk
reviewed
Apr 25, 2023
aviatesk
reviewed
Apr 25, 2023
getindex(Dict) and objectidobjectid and getindex(::Dict)
d8c0deb to
a582220
Compare
aviatesk
approved these changes
Apr 25, 2023
Member
aviatesk
left a comment
There was a problem hiding this comment.
Added some changes on my own. Should be ready to go if CI goes successfully.
oscardssmith
added a commit
that referenced
this pull request
Oct 4, 2023
As pointed out in #51594 (comment), this is necessary for the assertion added in #49447 to be valid.
oscardssmith
added a commit
that referenced
this pull request
Oct 5, 2023
KristofferC
pushed a commit
that referenced
this pull request
Oct 9, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With these changes (and #49260) we can now tab complete through dictionaries.EDIT: It's not necessary.The
objectidimprovement is needed forDict{Symbol, T}sincehash(Symbol)callsobjectid.