39 ms·
The difference between types.Implements and types.Satisfies is mainly caused by a history reason. It is just a tradeoff between keeping backward compatibility a
by tapirl 2y ago
The difference between types.Implements and types.Satisfies is mainly caused by a history reason. It is just a tradeoff between keeping backward compatibility and theory perfection.
It is pity that Go didn't support the "comparable" interface from the beginning. If it has been supported since Go 1.0, then this tradeoff can be avoided.
There are more limitations in current Go custom generics, much of them could be removed when this proposal (https://github.com/golang/go/issues/70128 https://github.com/golang/go/issues/70128) is done.
I recommend people to read Go Generics 101 (https://go101.org/generics/101.html https://go101.org/generics/101.html, author here) for a thoroughly understanding the status quo of Go custom generics.