-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
reflect: Is reflect.Type guaranteed to be hashable? #6535
Labels
Milestone
Comments
The standard library is full of maps with reflect.Types as keys, so you can depend on it. Perhaps it should be documented although in such matters we don't usually say what works, only what doesn't.. Labels changed: added priority-later, documentation, removed priority-triage. Status changed to Accepted. |
According to the language spec, the only restriction on a map key type is that the comparison operators be fully defined. And the documentation for the String method says that Type values may be compared. So it follows that Type values must be usable as map keys. But certainly the documentation could be more clear here. |
Change https://golang.org/cl/85815 mentions this issue: |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: