3 ms·
Zig is pretty close to being both at once, simply because they've found clever ways of combining existing features to avoid needing entirely separate features t
by dralley 6y ago
Zig is pretty close to being both at once, simply because they've found clever ways of combining existing features to avoid needing entirely separate features to accomplish the same goals.
e.g.
They avoid the macro system by leaning hard on compile-time evaluation, leveraging dead code elimination to replace preprocessor/macro-driven conditional compilation.
They get generics in a similar way, by letting compile-time functions construct types.
Varargs are implemented with anonymous structs, and modules are also secretly just structs, which makes interop with C much simpler.
It's actually deeply impressive how far they've been able to go with a language that actually has quite a small number of separate constructs, and it doesn't feel hobbled by doing so.