Re:Proposal: Go should have generics
by jimbokun on Thursday April 14, 2016 @02:47PM
(#11499373)
The canonical solution to this problem is to provide a function to perform the comparison, or to require the types implement a "Sortable" or "Comparable" interface.
[ Parent
| on HN ]
yes, which for 57 different types and/or comparison methods requires 57 different functions... which is basically the exact same thing you do in Go. It's just in go, you define a new type based on the original value, rather than just a function.