News for hackers. Stuff that matters.
Re:Zig's Comptime Is Bonkers Good by nimish on Tuesday January 07, 2025 @12:37PM (#42625056)
This is _also_ doable with the ability to constrain generics.

sort<A> where A implements Comparable

Simpler explanation IMO.

Re:Zig's Comptime Is Bonkers Good by tines on Tuesday January 07, 2025 @01:09PM (#42625388)
Not really an "also", "implements" is just syntax sugar for what the GP is saying.
Re:Zig's Comptime Is Bonkers Good by nimish on Tuesday January 07, 2025 @03:29PM (#42627050)
Sure, 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.