Skip to content
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

add impl Hash for Type. #1329

Closed
doug-q opened this issue Jul 22, 2024 · 0 comments · Fixed by #1347
Closed

add impl Hash for Type. #1329

doug-q opened this issue Jul 22, 2024 · 0 comments · Fixed by #1347
Assignees

Comments

@doug-q
Copy link
Collaborator

doug-q commented Jul 22, 2024

This is very useful, allowing HashSets and HashMaps keyed by types. For example I would like to use this to remember for which types I have generated destructors (or decided I don't need a destructor).

I have done this in #1157 , it is not too bad.

An alternative that would solve my problem would be to impl Ord for Type.

There is some concern that this might be expensive. Types are immutable so this could be mitigated by adding a hash field to types which may have a large number of "sub-Types". We could use interior mutability to not compute the hash until it was needed for the first time.

@doug-q doug-q linked a pull request Jul 25, 2024 that will close this issue
@doug-q doug-q self-assigned this Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant