4 ms·
I was glad to find they made it much easier to define custom sorts for slices. But! Why on earth does what should really be syntactic sugar make sorting nontriv
by rusbus 10y ago
I was glad to find they made it much easier to define custom sorts for slices. But! Why on earth does what should really be syntactic sugar make sorting nontrivially slower?
It speaks to the lack of expressiveness in golang that you can't make sorting less egregiously verbose without adding a performance penalty.
- zzzcpan 10y ago> what should really be syntactic sugar They probably use run time reflections, not a compile time syntactic sugar a.k.a. generics. As Go doesn't have those, so anything like that would require a compiler hack and nobody likes hacks.
- DougBTX 10y agoSyntax sugar is extra syntax to make an existing feature easier to use, syntax sugar has no runtime impact. Generics are not syntax sugar, they add functionality such as stricter compile-time type checking and improved run-time performance (e.g., C# can use unboxed primatives in generics)