News for hackers. Stuff that matters.
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.
Re:Proposal: Go should have generics by NateDad on Thursday April 14, 2016 @03:34PM (#11499697)
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.