5 ms·
Bash scripts and (optionally) an assembler can do this. That's not really the point.
by dwattttt 2y ago
Bash scripts and (optionally) an assembler can do this. That's not really the point.
- pipeline_peak 2y ago> Bash scripts and (optionally) an assembler What do you mean by that ?
- dwattttt 2y agoIn much the same way as "being Turing complete means you can do anything", it just being possible to do compile-time execution isn't the reason Zig is exciting here. C++ adding the same features means it'll be possible, but it has a much larger intersection of alternative features to introduce edge cases with, and _many_ implementations that will have this feature with varying quirks: all of this means C++ will have to do a _much_ better job than Zig does here to achieve nearly the same result.
- rowbin 2y agoThanks for that. I loathe replys like "but lang/framework/... can do/will be able to do something similar/does something else which I like better/...". Well, it's not about that. It's about how easy it is to use, how good it is from preventing you to shoot yourself in the foot, sometimes how performant it is, ...
- benatkin 2y agoIt's suggesting that Zig is convenient and that C/C++ won't be. I think both will be nice.
- carlos22 2y agoWell C++ has a history of not really being convenient and makes it easy to shoot you in the foot.
- logicchains 2y agoThat's something different, code generation. The point is that C++26 will have compile-time reflection without any need for an external code generation tool, similar to Zig.
- kstrauser 2y agoWith the main difference being that if you start Zig today, you’ll get to use that a good decade before it’s reliably available in C++. Hmm. Actually, now that makes me want to learn Zig.
- kevin_thibedeau 2y agoConsteval is usable today for a lot of scenarios that would require code generation tooling in years past.
- dwattttt 2y agoHow does consteval interact with thread_local? Defined (although I'm not sure what definition could make sense), error, or the dreaded "No diagnostic required"?
- flohofwoe 2y agoIn the end, generics, comptime and code generation are just different steps on the 'stamping out specialized code and data' ladder though (e.g. all three are useful).
- int_19h 2y agoErgonomics matters, though. In C++, this feature is bolted onto the language decades after it was originally designed. Zig is designed around this from the get go (which is why it doesn't have e.g. templates as a distinct feature).