3 ms·
Not GP, and I'm just surfing unfamiliar docs, but it looks like, yes, there's general parameter polymorphism,[1] but also "modules" presented as structs,[2] and
by mncharity 4y ago
Not GP, and I'm just surfing unfamiliar docs, but it looks like, yes, there's general parameter polymorphism,[1] but also "modules" presented as structs,[2] and the polymorphism of struct constructors can have nontrivial impacts[3](eg Map(KeyType,void) loses value setters). Fwiw.
[1] https://ziglang.org/documentation/master/#comptime https://ziglang.org/documentation/master/#comptime "Compile-time parameters is how Zig implements generics. It is compile-time duck typing."
[2] https://ziglang.org/documentation/master/#import https://ziglang.org/documentation/master/#import
[3] https://ziglang.org/documentation/master/#void https://ziglang.org/documentation/master/#void "By using void as the type of the value, the hash map entry type has no value field, and thus the hash map takes up less space. Further, all the code that deals with storing and loading the value is deleted, as seen above."
- Rochus 4y agointeresting, thanks