2 ms·
How common is the need for bootstrapping when you have cross-compilers?
by Dwedit 4y ago
How common is the need for bootstrapping when you have cross-compilers?
- fantyoon 4y agoThe need for bootstrapping in this context comes from the lack of a compiler for the language you want to implement, as in before the Zig compiler in C++ there was no Zig compiler.
- lifthrasiir 4y agoCross-compilers are about target platforms (e.g. producing a macOS executable from Windows). We are talking about implementing a language in a different language. (The word "bootstrap" is very general and can be used for both cases.)
- skitter 4y agoIf you want to have a Zig compiler written in Zig, you need to bootstrap it once initially. Cross compilation makes it so you don't need to do that again when you want the compiler to work on a different architecture. Of course, there's the question of why you want to self-host your compiler (instead of keeping the C++ one): - dogfooding identifies problems & helps prioritizing - it demonstrates that the language is suitable for serious projects - most importantly, Zig developers prefer writing Zig over having to use C++
- kristoff_it 4y agoThe main use case here is not as much building Zig for an new architecture, as it is a way to let contributors build latest Zig trivially. Without a bootstrap process like this one, it could happen that you run git pull and then can't build the compiler because it's using a new feature that the version of the compiler you have doesn't support yet. The wasm process ensures that you can always build the latest commit.
- kzrdude 4y agogcc bootstraps using itself. Rust bootstraps using itself. Go bootstraps using itself. D bootstraps using itself. Zig bootstraps using itself. It seems pretty common :)