Live data from Hacker News

Zig is now self–hosted by default

github.com

71–80 of 115 posts

Re: Zig is now self–hosted by default

#71
post #66
post #44

I 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…

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.

Re: Zig is now self–hosted by default

#72

Earlier quoted context omitted.

Because a large motivation of developing a new language is wanting to program in that new language. Being forced to keep programming in C can become very frustrating.

Although if you're Jonathan Blow you can stream yourself writing C++ and ranting about how terrible C++ is, while implementing your new Jai language. [I watched a few hours of Jon doing this, but annoyingly I can't find a recording of Jon actually finding and fixing the subtle Heisenbug he realises during those hours must be in his Jai code - he resolves to investigate "later" and I can't find "later". I think this w…

It was quite a pleasure for me when the D compiler was converted 100% into D. I immediately set about refactoring it (a process that continues today).

One consequence is that pointer bugs in the compiler have become extremely rare.

Re: Zig is now self–hosted by default

#73

Earlier quoted context omitted.

I believe the goal is to replace the C++ with a C bootstrap that is initially auto generated from the zig code by zig but manually cleaned up and maintained to match

Why?

I think because Zig compilers can compile C but not C++.

Re: Zig is now self–hosted by default

#74
post #40

Earlier quoted context omitted.

C++ stage1 compiler is a magic binary blob :)

It's possible to bootstrap GCC starting from only a 357-byte binary seed: https://github.com/fosslinux/live-bootstrap

This work is impressive, but ... that's still a binary blob, and isn't the system it has to be run on kind of one as well?

Re: Zig is now self–hosted by default

#75

Earlier quoted context omitted.

Although if you're Jonathan Blow you can stream yourself writing C++ and ranting about how terrible C++ is, while implementing your new Jai language. [I watched a few hours of Jon doing this, but annoyingly I can't find a recording of Jon actually finding and fixing the subtle Heisenbug he realises during those hours must be in his Jai code - he resolves to investigate "later" and I can't find "later". I think this w…

It was quite a pleasure for me when the D compiler was converted 100% into D. I immediately set about refactoring it (a process that continues today). One consequence is that pointer bugs in the compiler have become extremely rare.

One time I needed an AVR programmer for a test stand that didn't suck[1] and didn't backfeed the device under test. So I designed one using an AVR. And programmed it with the crappy one. Then I programmed the next one with the first one.

Feels good.

[1] Atmels cheap USB programmer would lose it's mind if the programming pins aren't all connected[2]. Tech had to reset it manually by unplugging the USB cable. If it happened a couple of times in a row, windows would disable the USB port.

[2] Board house liked to put their inspection stamp on top of the programming port pads.

Re: Zig is now self–hosted by default

#76
post #47
post #44

I 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…

You don’t know if the product you’re building is any good unless you’re using it yourself.

Also known as dogfooding.

Re: Zig is now self–hosted by default

#77
post #53
post #44

I 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 understand that C is the same way and that there are benefits for language developers in using their own language, so I can't complain too loudly about languages that do this, but I can attest to the "nightmare" that this creates. I have personally ported java to an operating system that didn't previously have a java compiler. A colleague recently ported rust. Neither had usable cross-compilers. Both require a comp…

Since February, the mrustc project [0] has been capable of bootstrapping a relatively-recent Rust compiler from C++. (It currently takes another 8 Rust-to-Rust steps to reach the latest stable version.) I've personally tested it on my x86_64-linux-gnu machine, but I don't know how tough it would be to get it to support new targets.

[0] https://github.com/thepowersgang/mrustc

Re: Zig is now self–hosted by default

#78
post #66
post #44

I 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…

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.

Re: Zig is now self–hosted by default

#79
post #53
post #44

I 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 understand that C is the same way and that there are benefits for language developers in using their own language, so I can't complain too loudly about languages that do this, but I can attest to the "nightmare" that this creates. I have personally ported java to an operating system that didn't previously have a java compiler. A colleague recently ported rust. Neither had usable cross-compilers. Both require a comp…

In case of Java, wouldn't you only need to bootstrap JVM? Bytecode for the initial compiler can be compiled on another platform and then brought over.

Re: Zig is now self–hosted by default

#80

To 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…

Hi Andrew, sorry for the unrelated question but where can we find the financial reports of the Zig Software Foundation for 2022? The Finances spreadsheet hasn't been updated for the past half a year: https://docs.google.com/spreadsheets/d/14_ljFHGFXY5NhBhlfjgk...

Isn’t it quite common to only do financial reports only every quarter, 6 months, yearly?
Post reply on HN