4 ms·
Can you elaborate a bit on the first issue?
by vram22 6y ago
Can you elaborate a bit on the first issue?
- jeltz 6y agoTake for example the definition of floor(), how would an IDE or documentation generator see which types are supported? This is just imperative code which is executed at compile time and at least to me it is not obvious how to interpret it when generating the documentation. On the other hand in Rust it is almost always easy to see which types can be used where. pub fn floor(x: anytype) @TypeOf(x) { const T = @TypeOf(x); return switch (T) { f16 => floor16(x), f32 => floor32(x), f64 => floor64(x), f128 => floor128(x), else => @compileError("floor not implemented for " ++ @typeName(T)), }; }
- haberman 6y agoThis seems reasonable to me. It seems comparable to the following in C++: template <class T> T floor(T x) { /* ... */ } I think a documentation generator could display your Zig signature verbatim and a user could make sense of that.