-
Notifications
You must be signed in to change notification settings - Fork 247
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
WeakObjectIdDict & more general dicts #42
Comments
For everything that wraps |
Tnx for looking into this. The method concerned here is |
Okay. Are you importing hashindex() before overriding for HashDict and On Wednesday, June 18, 2014, Mauro notifications@github.com wrote:
|
At the moment I just copy-pasted There should be a way to unify all the hash-based dicts including this one. You have been pursuing this quest for a wee while, maybe you got some insights on how to solve this more generally? |
I think this is stalled and can be closed? |
I'm looking for a weak object-id dict for JuliaLang/julia/pull/5572. There is one implementation here: JuliaLang/julia/issues/3002. One feature needed is that it also works with immutable keys.
A potentially general way to go about this is to add two features to HashDict:
add_weak_key
function in Base does.)hashindex
function. For object-id it would look:hashindex(key, sz) = (int(hash(object_id(key))) & (sz-1)) + 1
I'm not sure how to go about this: The usual way would be to use dispatch on the functions:
hashindex(::Associative, key, sz) = (int(hash(key)) & (sz-1)) + 1
. However, becauseHashDict
is wrapped this does not work (or at least I cannot see how). Any ideas on how to go about this?The text was updated successfully, but these errors were encountered: