3 ms·
> Zig has awesome metaprogramming support I'm not sure how to reconcile this statement with the following claim from the linked article: "Zig has no macros and
by kibwen 8y ago
> Zig has awesome metaprogramming support
I'm not sure how to reconcile this statement with the following claim from the linked article: "Zig has no macros and no metaprogramming yet still is powerful enough to express complex programs in a clear, non-repetitive way." Not only does it claim that Zig has no metaprogramming, it suggests that it sees metaprogramming as undesirable.
- mborch 8y agoWhat it does have is compile-time parameters where you can bind a type variable during compilation: fn max(comptime T: type, a: T, b: T) T { if (T == bool) { return a or b; } else if (a > b) { return a; } else { return b; } } The type variable isn't used at run-time.