This seems like an incredibly well run project. They have a consistent vision, and seem to work tirelessly to bring it to fruition. I love how precisely they’ve defined their goals.
On any platform it can without any effort cross build for most other platforms which means "that --library c for these targets does not depend on any system files!"
"This means that this functionality is available on any platform. Windows and macOS users can build Zig and C code, and link against libc, for any of the targets listed above. Similarly code can be cross compiled for other architectures"
"In some ways, Zig is a better C compiler than C compilers!"
And it's all immediately available after the download. I am not aware of anything comparable that offers that functionality.
And currently "self hosting" is in development, which should longer-term allow language's independence of LLVM. The way I understand it, it will make the product even more usable on additional platforms. The "self hosting" aspects and goals are known to the Zig developers but I hope a nice explanation of what will be achieved will be written.
What I still miss is an explanation of how generating good code on the platforms currently not supported by the LLVM will be achieved, which is what a language intending to be widely used instead of C would somehow have to address. Will it support compiling Zig code to C and using the platform C compilers?
There is a C backend in the works, so yes, it will be possible to do that (which is also part of the plan for bootstrapping the compiler), but the main way of producing release binaries is still going to be through LLVM for the foreseeable future.
"The plan for this is now to, at some strategic moment, utilize the C backend of stage2 to do a one time thing where we delete stage1 and replace it with the C backend output of stage2. The reason this won't be problematic for bootstrapping (#853) is that we won't keep doing it. The new stage1 C code will then get manually cleaned up and reorganized, and start being manually maintained to keep up with stage2, therefore granting it "source" status rather than "generated file" status."
Can anybody explain in more words that paragraph? As far as I understand "stage1" is a minimal compiler, written in C, needed to compile the sources of the full-featured compiler (which is called stage2) which are written as zig sources? The minimal compiler doesn't have to produce optimal code but has to support all the features used in the sources of stage2. Is that correct? Effectively, all the functionality used by the zig stage2 would have to be maintained both as C and as zig (twice) (I refer to the "manually maintained" sentence)? Is that the correct interpretation? Wouldn't it be better to remove the duplication by keeping the "core of the core" "simply" in C sources?
It's a design trade-off. Zig makes understanding the code with only local context a fairly high priority (also see their multiline string syntax), and that's more-or-less incompatible with user-defined operators.
You can have vectors, you just have to either comptime or runtime dispatch over methods, rather than through overloading operators. I understand for some people that's not going to be satisfactory enough, but it's not something that can't be done in an absolute sense.
One of the goals of Zig is to keep the language simple.
From the website:
"There is no hidden control flow, no hidden memory allocations, no preprocessor, and no macros. If Zig code doesn't look like it's jumping away to call a function, then it isn't. This means you can be sure that the following code calls only foo() and then bar(), and this is guaranteed without needing to know the types of anything:"
13 comments
[ 2.7 ms ] story [ 39.6 ms ] threadhttps://ziglang.org/#Zig-ships-with-libc
On any platform it can without any effort cross build for most other platforms which means "that --library c for these targets does not depend on any system files!"
"This means that this functionality is available on any platform. Windows and macOS users can build Zig and C code, and link against libc, for any of the targets listed above. Similarly code can be cross compiled for other architectures"
"In some ways, Zig is a better C compiler than C compilers!"
And it's all immediately available after the download. I am not aware of anything comparable that offers that functionality.
And currently "self hosting" is in development, which should longer-term allow language's independence of LLVM. The way I understand it, it will make the product even more usable on additional platforms. The "self hosting" aspects and goals are known to the Zig developers but I hope a nice explanation of what will be achieved will be written.
What I still miss is an explanation of how generating good code on the platforms currently not supported by the LLVM will be achieved, which is what a language intending to be widely used instead of C would somehow have to address. Will it support compiling Zig code to C and using the platform C compilers?
https://github.com/ziglang/zig/issues/5246
and the most recent entry (Sep 2):
"The plan for this is now to, at some strategic moment, utilize the C backend of stage2 to do a one time thing where we delete stage1 and replace it with the C backend output of stage2. The reason this won't be problematic for bootstrapping (#853) is that we won't keep doing it. The new stage1 C code will then get manually cleaned up and reorganized, and start being manually maintained to keep up with stage2, therefore granting it "source" status rather than "generated file" status."
Can anybody explain in more words that paragraph? As far as I understand "stage1" is a minimal compiler, written in C, needed to compile the sources of the full-featured compiler (which is called stage2) which are written as zig sources? The minimal compiler doesn't have to produce optimal code but has to support all the features used in the sources of stage2. Is that correct? Effectively, all the functionality used by the zig stage2 would have to be maintained both as C and as zig (twice) (I refer to the "manually maintained" sentence)? Is that the correct interpretation? Wouldn't it be better to remove the duplication by keeping the "core of the core" "simply" in C sources?
- Just a note for those who might miss the part of the page where it says the same.
In my view modern languages should provide vector math stuff.
From the website:
"There is no hidden control flow, no hidden memory allocations, no preprocessor, and no macros. If Zig code doesn't look like it's jumping away to call a function, then it isn't. This means you can be sure that the following code calls only foo() and then bar(), and this is guaranteed without needing to know the types of anything:"