I think Zig is great and I'm following it with interest. But I think people should be aware that it is not really stable yet, at least in my experience from trying it earlier this year. I ran into a compiler crash: https://github.com/ziglang/zig/issues/7865 . I attempted to fix the compiler crash myself ( https://github.com/ziglang/zig/pull/8372 ), and I found a fix that worked, but apparently it was not the right fi…
Why would they spend the effort on writing the zig compiler in zig?
* Debugging is easier, faster, and more straightforward
* Fewer bugs due to footguns in the language
* Typical Zig code runs faster than typical C++ code. Part of this is due to Zig's safety features - there are design optimizations for performance that I won't even attempt in C or C++ because it's footgun city. Meanwhile in Zig it's actually completely safe in debug builds; you get a compile error or runtime panic if you mess up something.
* Floating point operations work on f16 and f128 without a dependency on SoftFloat library
* Cross compilation is trivial
* Comptime features make build options feasible and maintainable, such as enabling/disabling logging, whether to link libc, whether to link llvm, whether to enable tracy profiling, etc.
* Zig's error handling makes correct code the default instead of the other way around in C++
* The std lib HashMap, ArrayHashMap, and ArrayList data structures are really nice
* If the compiler is written in Zig, then adding a new target backend to the Zig compiler makes the Zig compiler work on that target. With another language we are stuck only supporting whatever that language supports.
Not only that but the Zig compiler available for download today is already backed by majority of lines of code written in Zig rather than C++; what is available today is already partially self-hosted. For example the following features are already written in Zig, not C++: `zig fmt`, `zig translate-c`, the command line interface, `zig cc`/`zig c++`, `zig build`, the cache system, compiler-rt, the macOS linker, and compile error checks that operate before type checking.