3 ms·
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://d
by vlovich123 11mo ago
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/ https://docs.rs/comptime/latest/comptime/
- CathalMullan 11mo agoThere are plans to experiment with language level comptime support too: https://github.com/rust-lang/rust/pull/148820 https://github.com/rust-lang/rust/pull/148820
- smj-edison 11mo agoOh 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.
- zozbot234 11mo agoThis 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.
- the__alchemist 11mo agoLove this. Borrow all the good ideas! Would also enjoy compile-time trig functions, exponents etc so we are not invoking lazy/static/once-cell/lazy-cell etc.