3 ms·
This was a great post for one reason in particular: it led me down a huge rabbit hole about Zig, which honestly I knew little about before this. And further, in
by cletus 6y ago
This was a great post for one reason in particular: it led me down a huge rabbit hole about Zig, which honestly I knew little about before this. And further, into what is perhaps Rust's achilles heel: compile times.
Zig does look interesting. I'm still wrapping my head around the consequences of comptime but fast compile times and easy interoperability with C (C to Zig and Zig to C) are all positives. And yes I know Rust can compile to a C ABI.
It's also interesting to me that the Zig compiler only verifies if a particular instantiation of a "generic" is correct, not all versions. This makes it closer in some ways to C++'s templates (which, at the end of the day, are little more than string substitution). Like the functor pattern arose in C++ and was made possible by essentially just stringing symbols together and the compiler telling you if you could dereference a type (if you could ever figure that out from 8 pages of template errors in gcc; clang was better).
Rust it seems also generates a ton of IR and leaves the LLVM backend to optimize it away. I found an article talking about the history of how this evolved from the early days of Servo and Rust.
I know there's an ongoing effort to, say, add constexpr like behaviour to Rust. I worry if we'll get to a point where we are with C++, where we constantly bolt things onto it to the point that the language is incredibly complex, forcing people to use a sand and minimal subset.
- Ambroisie 6y agoDo you still have a link to that article about rust's IR generation?
- cletus 6y agoSorry, yes: https://pingcap.com/blog/rust-compilation-model-calamity https://pingcap.com/blog/rust-compilation-model-calamity HN post: https://news.ycombinator.com/item?id=22197082 https://news.ycombinator.com/item?id=22197082