3 ms·
As a C programmer, I didn't like that Zig just gets rid of macros. I prefer the Rust approach to make better macros.
by okareaman 5y ago
As a C programmer, I didn't like that Zig just gets rid of macros. I prefer the Rust approach to make better macros.
- CheezeIt 5y agoOne big benefit I see is that it increases design pressure on other features of the language.
- stephc_int13 5y agoI think they also have better macros, with compile time code evaluation.
- lerno 5y agoThere are many ways to approach macros. Zig’s approach with compile time evaluation handles many of them. Esp since types can be created on the fly. Another approach, which is strongly inspired by the ASTEC project for C, is what I use for my C-like “C3”: http://www.c3-lang.org/macros/ http://www.c3-lang.org/macros/ Zig’s clearly about a more homogeneous approach where I am happy to have multiple pieces of syntax to cover different usecases.
- jcelerier 5y agoIt's always possible to use the C preprocessor on non-C files, I saw people do it in Java and I heard it's somewhat common in C#; it's also used by various Unix utilities (X11 for Xrdb for instance). So technically every language can have C macros :-)