logoalt Hacker News

CamouflagedKiwiyesterday at 12:45 PM2 repliesview on HN

requires is also new (not sure exactly when that appeared, it's after the last time I wrote C++ in anger) although I think it's fairly clear what it means. I can only guess at the other two.

Not familiar with Zig but AFAICT `inline for` is about instructing the compiler to unroll the loop, whereas `template for` means it can be evaluated at compile time and each loop iteration can have a different type for the iteration variable. It's a bit crazy but necessary for reflection to work usefully in the way the language sets it up.


Replies

NooneAtAll3yesterday at 2:26 PM

requires is concept, one of big-C-words of ++20

ginkoyesterday at 12:53 PM

Zig's inline for is also evaluated at comptime:

https://ziglang.org/documentation/master/#inline-for

show 1 reply