You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Standard Library creates a new Interface like fmt.Stringer or fmt.GoStringer called builtin.Hasher{ Hash() string}.
Where appropriate, all comparable standard library types implement Hasher which returns a unique hash that represents the contents of that type. Ideally, this function remains stable irrespective of how the internals of the type change in the future (except for changes that effect the exported behaviour of the type)
In my use-case:
@bcmills in #6535 asks if reflect.Type is hashable. The response from the Elders is that it is comparable. That was satisfactory for OP.
However for faster comparisons, comparable and hashable are not the same. I suspect having reflect.Type for map keys is not as fast for lookups as a hash of that same reflect.Type for map keys.
The text was updated successfully, but these errors were encountered:
Proposal Details
This proposal is that:
fmt.Stringer
orfmt.GoStringer
calledbuiltin.Hasher{ Hash() string}
.Hasher
which returns a unique hash that represents the contents of that type. Ideally, this function remains stable irrespective of how the internals of the type change in the future (except for changes that effect the exported behaviour of the type)In my use-case:
@bcmills in #6535 asks if
reflect.Type
is hashable. The response from the Elders is that it is comparable. That was satisfactory for OP.However for faster comparisons, comparable and hashable are not the same. I suspect having
reflect.Type
for map keys is not as fast for lookups as a hash of that samereflect.Type
for map keys.The text was updated successfully, but these errors were encountered: