News for hackers. Stuff that matters.
Re:Zig's Comptime Is Bonkers Good by lmm on Tuesday January 07, 2025 @08:45AM (#42622213)
To be parametric it needs to be the same body semantically, not just textually. Particularly in C++ with its heavy operator overloading and limited safety, you can very easily write a template whose body will do the right thing for some types and be undefined behaviour for others (e.g. if your template has comparisons in it and then you instantiate it with a pointer or something).

There are no comments on this comment yet.