RFC: IdDict{K,V} as wrapped ObjectIdDict #25196
Closed
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.
This adds an
IdDict{K,V}
which uses===
andobject_id
for equality and hashing as is needed for #24354. It is implemented by wrapping the good oldObjectIdDict
and using type assertions on the getters/setters. This is an alternate implementation of #24932, as was suggested by @JeffBezanson in #24932 (comment). Unlike #24932, this PR passes all tests locally and should be mostly ready to go.This PR deprecates the "old"
ObjectIdDict
in favor of the newIdDict
. To make this work I had to renameObjectIdDict
to something else:_ObjectIdDict
. Note though that_ObjectIdDict
is still used and needed in the core of Julia.Performance of the
IdDict
is a bit worse (25%) than forObjectIdDict
, presumably because of the extra layer, as the somewhat rudimentary tests in the gist show.RFCs:
ObjectIdDict
necessary or could it be deprecated without rename?IdDict
dictionary type, which is specially handled by precompilation so that it is safe to initialize at compile-time." Is this still true? If not it probably should be made true. This needs checking by someone!This should probably be squashed before merging.