-
-
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
WIP: remove fallback hash
method. fixes #12198
#24354
Conversation
38a1db2
to
4aa0205
Compare
Sigh, Documenter has a few dictionaries with keys that don't have |
I like the idea of |
hash
method. fixes #12198hash
method. fixes #12198
Maybe call it |
Can we just add parameters to |
|
I also remember once doing something like that in https://github.com/JuliaLang/julia/compare/jn/iddict before too. I think Jeff wasn't convinced it was worthwhile to change the memory layout, since the cases in which you know what you wanted to store, but can't hash it (translation: you want to add type parameters, but the object could be anything), are rare or non-existent. |
Ideally, yes, but unfortunately (for us, not him), @JeffBezanson is on vacation until early next week. Someone may need to pick this up for him, or we may need a few extra days to get this in. |
Here's my initial experiment towards removing this method. Overall I think it's a good change; it caught a few cases of sketchy hashing in Base. Haven't tested thoroughly yet; let's see what CI thinks.
I guess we might want to add a deprecation for this.
The most common issues I found were (1) using types as keys, and (2) checking for the presence of random objects in dictionaries that will never be found. With types,
===
and==
differ, and you can only sensibly hash them by object id. With the second problem, you try e.g.CrazyThing in set
, and the answer is false, but you get a method error thatCrazyThing
can't be hashed. There have been discussions in the past about giving errors when trying to look up objects that couldn't possibly match anything of the key type. Something like that could maybe solve this, but I'm not sure what to do. You might just need to be careful when looking up something whose type is totally unknown.