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
Type values are comparable, such as with the == operator, so they can be used as map keys. Two Type values are equal if they represent identical types.
The text was updated successfully, but these errors were encountered:
There are a few proposals about making comparable works better with interface types, including reflect.Type, see e.g. #51338 , #52509 , #53734 . Closing this as a dup. Thanks.
@cherrymui This must be at least mentioned in the docs. Because the word "comparable" now has specific meaning and the documentation for Type becomes misleading.
I agree that using the same name for both is kind of confusing. Unfortunately English has limited words in this space so we have to make do with what we have. As the links that Cherry mentioned make clear, it was originally intended that comparable include interfaces, but we took it out because we were not sure about the semantics, and we wanted to be on the safe side of backwards compatibility.
Indeed:
I believe the above should work per the:
The text was updated successfully, but these errors were encountered: