I find this part of the type constraint design particularly lame. Here one can't extend the constraint over an arbitrary type, making the cmp.Ordered pretty useless. And that seems like a severe language limitations since one can't implement a constrain of a kind:
interface Comparable {
compare(that Self) int // where Self typevar is bound to the callee's type
}
func sort[T Comparable](slice ~[]T) ~[]T
1 comment
[ 4.5 ms ] story [ 104 ms ] threadhttps://pkg.go.dev/cmp@master
I find this part of the type constraint design particularly lame. Here one can't extend the constraint over an arbitrary type, making the cmp.Ordered pretty useless. And that seems like a severe language limitations since one can't implement a constrain of a kind: