3 ms·
> I much prefer have two orthogonal systems which do their own business than having a single more powerful tool than do both (like having slices + references in
by pron 6y ago
> I much prefer have two orthogonal systems which do their own business than having a single more powerful tool than do both (like having slices + references instead of the all powerful pointer)
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).
- int_19h 6y agoZig 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.