2 ms·
I think most of those points one only stumbles over after a few thousand lines of Zig and going really deep into the comptime features. And some features in yo
by flohofwoe 2y ago
I think most of those points one only stumbles over after a few thousand lines of Zig and going really deep into the comptime features.
And some features in your list are of questionable value IMHO (e.g. the "reasoning over a function type signature" - Rust could be a much more ergonomic language if the compiler wouldn't have to rely on function signatures alone but instead could peek into called function bodies).
There are definitely some tradeoffs in Zig's comptime system, but I think the more important point is that nothing about it is surprising when working with it, it's only when coming from languages like Rust or C++ where Zig's comptime, generics and reflection might look 'weird'.
- eptcyka 2y ago> Rust could be a much more ergonomic language if the compiler wouldn't have to rely on function signatures alone but instead could peek into called function bodies This path leads to unbounded runtime for the type checker/borrow checker. We’re not happy about build times as is.
- littlestymaar 2y agoAnd also lead to subtle errors for users of crates. Semver is hard enough to do when the compiler only deals with signatures, but if the body of the functions now contain invariants that can be relied on by function callers then it becomes intractable.
- lmm 2y ago> most of those points one only stumbles over after a few thousand lines of Zig and going really deep into the comptime features. > nothing about it is surprising when working with it I think there's a contradiction here - when you get deep into using this kind of feature in a complex way is precisely when you most need it to behave consistently, and tends to be where this kind of ad-hoc approach breaks down.
- throwawaymaths 2y agoif youve never gone deep into zig comptime... really nothing is surprising, except possibly when you can't do things and usually after a bit of thinking about it you understand why you can't.