Remix.run Logo
matklad 6 hours ago

You need to learn both. Both borrow checker (Rust) and comptime (Zig) are huge ideas worth getting your hands dirty with.

If you don't have time to learn both, then learn Zig, as it requires much smaller time investment (though do try to find time for both).

vlovich123 6 hours ago | parent [-]

For what it’s worth there’s a comptime crate for Rust. Not as elegant as a language level feature but probably accomplishes very much similar things.

https://docs.rs/comptime/latest/comptime/

CathalMullan 6 hours ago | parent [-]

There are plans to experiment with language level comptime support too: https://github.com/rust-lang/rust/pull/148820

zozbot234 2 hours ago | parent | next [-]

This is a very interesting feature, especially if comptime can become a true language superset with features such as the ability for seamless type-level programming, leveraging `const fn` code throughout. This would unlock the potential for having true dependent types in (the comptime portion of) Rust programs, and write arbitrary end-to-end compiler-verified proofs about code that will ultimately run in the final program.

smj-edison 3 hours ago | parent | prev [-]

Oh my gosh, that would be incredible! In one of my rust projects, I used enum dispatch so simple functions could be inlined, but it used a slightly hacky macro that couldn't do static dispatch. One of those things that comptime matches very well.