Earlier quoted context omitted.
Once upon a time C was bootstrapped as well. A great outcome of bootstrapped compilers is that most contributors can use the language they known instead of two, and better it kills the myth that C is the only game in town for writing compilers.
C is a wretchedly bad language for writing compilers.
Zig is now self–hosted by default
91–100 of 115 posts
Re: Zig is now self–hosted by default
#92Earlier quoted context omitted.
Once upon a time C was bootstrapped as well. A great outcome of bootstrapped compilers is that most contributors can use the language they known instead of two, and better it kills the myth that C is the only game in town for writing compilers.
> it kills the myth that C is the only game in town for writing compilers A compiler is a pretty pure, high-level operation. Makes no sense to use a low-level language for it.
Hence why stuff like MaximeVM, Jikes and now Graal are so relevant.
Re: Zig is now self–hosted by default
#93Earlier quoted context omitted.
I'd call tools like ASAN and friends debug tooling. I'm not sure if zig has tooling that doesn't have an analogue in the c++ world, but having them built in to the compiler by default is a notable feature.
Right, defaults matter. The fact sanitizers exist is much less of a game changer than the default behaviour being sanitized. Because C++ defaults are notoriously all wrong, in programming language design you could usually do worse than consider, "Is there an alternative to what C++ does here by default?" and if there is one, choose that alternative as your default because it's more likely to be correct. Sometimes C++…
Those that care know where the knobs are to re-enable those proper defaults, given that for some domains, C++ is going to stay around for a while, regardless of the alternatives.
Re: Zig is now self–hosted by default
#94I never understood why "self-hosting" is considered a good thing. Sure, the compiler developers can write in their favorite language and I guess it means the language is stable enough to be used in a complex project; however requiring an (older) compiler to build the compiler seems a significant complication for software distributions. You either have to set up an ever increasing chain of compilers, as the complexity…
I believe Andy noted that it's way easier to find contributors for the self hosted compiler. If someone is passionate about the language, they want to write the language, not C++. And specifically for languages like Rust and Zig, the explicit orthodoxy is that the language is a better successor to C++/C. If you're spending your time telling people that they shouldn't write C++/C and should instead write your language…
Ruby and Python are scripting language, as such seldom bootstraped.
Re: Zig is now self–hosted by default
#95Earlier quoted context omitted.
There's a third option that you missed which is what Zig does. It has a "bootstrap" compiler, written in C, which is kept in sync with the self-hosted compiler. Features are implemented twice, once in the bootstrap compiler, once in the self-hosted compiler. So the build process involves a fixed set of steps - stage1, stage2, stage3 - and the chain never grows more than this. No pre-existing binaries are required.
> No pre-existing binaries are required. Except for of course a c compiler.
Re: Zig is now self–hosted by default
#96I never understood why "self-hosting" is considered a good thing. Sure, the compiler developers can write in their favorite language and I guess it means the language is stable enough to be used in a complex project; however requiring an (older) compiler to build the compiler seems a significant complication for software distributions. You either have to set up an ever increasing chain of compilers, as the complexity…
If Zig is built on a C compiler, and (I assume) the C compiler self-hosts, then if Zig starts to self-host, it doesn't _introduce_ the dependency on a chain of previously built binaries, it just makes it a step more severe while removing a dependency. Would you prefer if Zig not only didn't self-host, but didn't have any self-hosting dependencies? For your ideal compiler, would a full build from scratch require makin…
Re: Zig is now self–hosted by default
#97Can't wait to see what comes down the pipeline for such a fantastic language!
Re: Zig is now self–hosted by default
#98To clarify what this means, since things can get confusing with subtle differences in wordings: * stage1 is when zig is built from C++ code[1] (the "bootstrap" compiler) using system C/C++ compiler toolchain. * stage2 is when zig is built from Zig code[2] using stage1. * stage3 is when zig is rebuilt from the same Zig code[2] using stage2. Before today, zig would give you stage1 by default, and you could opt in to st…
This seems fairly significant to me and makes me wonder how this is possible with all the effort that has gone into optimizing C++
Re: Zig is now self–hosted by default
#99Earlier quoted context omitted.
There's a third option that you missed which is what Zig does. It has a "bootstrap" compiler, written in C, which is kept in sync with the self-hosted compiler. Features are implemented twice, once in the bootstrap compiler, once in the self-hosted compiler. So the build process involves a fixed set of steps - stage1, stage2, stage3 - and the chain never grows more than this. No pre-existing binaries are required.
> No pre-existing binaries are required. Except for of course a c compiler.