3 ms·
Zig's `comptime` is not a silver bullet though: - it is duck typed, which to be fair macros are also, but variadic generics would be type checked at the defini
by SkiFire13 3y ago
Zig's `comptime` is not a silver bullet though:
- it is duck typed, which to be fair macros are also, but variadic generics would be type checked at the definition;
- it interacts badly with traits, that is if you allow both querying for implemented traits and creating new trait `impl`s then this can create cycles in the execution of comptime blocks, meaning the compiler needs to compute a fixpoint or arbitrarily give an error.
- Georgelemental 3y agoAlso, Rust has lifetimes which are erased prior to monomorphisation—so specializing based on them is unsound. Any `comptime` equivalent in Rust would have to limit the access of `comptime` blocks to lifetime information in some way.