3 ms·
This is _also_ doable with the ability to constrain generics. sort<A> where A implements Comparable Simpler explanation IMO.
by nimish 2y ago
This is _also_ doable with the ability to constrain generics.
sort<A> where A implements Comparable
Simpler explanation IMO.
- tines 2y agoNot really an "also", "implements" is just syntax sugar for what the GP is saying.
- nimish 2y agoSure, but it's the same thing in 10x fewer words. Having parametric generic types that accept constraints allows your functions to have the best of all worlds. So a language _with_ that is superior. All zig needs to do is add some way to allow for constraints.