9 ms·
WASM allows them to bootstrap Zig compiler on completely foreign systems that only have a C compiler. This solves the chicken-and-egg dilemma that occurs when o
by garganzol 4y ago
WASM allows them to bootstrap Zig compiler on completely foreign systems that only have a C compiler. This solves the chicken-and-egg dilemma that occurs when one wants to use a language under development to develop the language itself.
It's not about code size or efficiency. They are talking about the ability to use the latest versions of Zig for further development of the Zig compiler. This improves and speeds up the compiler development cycle by removing the limitations imposed by the bootstrap process.
- Kukumber 4y agoThat's exactly what i said, they regret writing their compiler in C++, and are too lazy to do a proper and optimized C rewrite, hence they go with WASM to then generate C code Reason why it still is running poorly, because it is the same implementation, just went with optimized code gen steps, making the source non human readable Seems like i was right when i made this comment few days ago: https://news.ycombinator.com/item?id=33763102 https://news.ycombinator.com/item?id=33763102
- garganzol 4y agoNope. The ultimate goal is to develop Zig in Zig. C and C++ are not the goals, they are means.
- derekp7 4y agoJust so you know, the reason your comment isn't productive (especially with the culture of this site) is that your are creating a projection of the developer's mind and motivations, that most likely isn't true (I doubt they are lazy, and I also doubt there is regrets there too).
- Kukumber 4y agoIt has generated a healthy discussion, that helped me get more insight on the matter, and will help future readers get a detailed insight on the matter too Not everyone is born with knowledge, we learn by igniting discussions
- jacquesm 4y agoThis is true, but you could have done it a bit more tactical, for instance by leaving out statements of judgment.
- wrycoder 4y agoIt did generate an interesting discussion, but your insulting tone caused your remark to be downvoted and flagged. Now the 85 interesting comments responding to you are lost to many HN readers. It would have been better if you had been more moderate.
- kllrnohj 4y ago> they regret writing their compiler in C++, and are too lazy to do a proper and optimized C rewrite lol, very few things migrate from C++ to C. Rather they do the reverse (like how GCC migrated from C to C++).
- moloch-hai 4y agoPlease identify a system where you might want to run a compiler, and there is no C++ compiler for it. There are of course many places you might run code that cannot host a compiler for any language. You use a cross compiler for those.
- satvikpendem 4y agoAre there not a lot of embedded systems that only have a C compiler?
- moloch-hai 4y agoYou want to run a Zig compiler on an embedded system?
- satvikpendem 4y agoNot sure I understand your question, why wouldn't someone want to use Zig (or Rust, or Nim) instead of C or C++?
- moloch-hai 4y agoThis is about the language the compiler itself is coded in. It would be absurd to try to run a compiler on your ESP microcontroller just because that is where the program you are compiling is supposed to run. (That does not stop Forth fans, of course.) People do often run compilers on RaspPis and the like (though rarely for any good reason), but those compilers are most often coded in C++, whatever the language it is compiling, just like Zig's original compiler. Most of the Rust compiler is in C++, and they have no plan to change that.
- TUSF 4y ago> Most of the Rust compiler is in C++, and they have no plan to change that. What? I just went and searched the Rust compiler, and the only C++ code to speak of was LLVM itself, and a thin wrapper around LLVM to provide a C API. Which is pretty much the same state that Zig is in right now. (Although in Zig's case, LLVM is optional) Yeah, it's a lot of C++ that the Rust compiler relies on, but I don't think most people would really compare things like that.