Re:Interview with Zig language creator Andrew Kelley [video]
by int_19h on Wednesday September 02, 2020 @07:08PM
(#24359257)
Zig comptime functions that take and return structs consisting partially (or wholly!) of types reminds me of OCaml functors, and should perhaps be compared to them rather than generics.
OK, but that's not quite the situation. Here we're talking about languages that have, or will have, the single "more powerful" construct, and also the more specific, special case one, as two separate constructs, even though one of them would have sufficed.
Again, Zig has parameterized types, and very elegant and powerful ones -- they're functions that take some types as argument and return a type. It just doesn't have generics as a separate construct. Rather, it is a special case of a more general one (that Rust and C++ will also have).