Live data from Hacker News

Zig is now self–hosted by default

github.com

111–115 of 115 posts

Re: Zig is now self–hosted by default

#111
post #42
post #37

Earlier quoted context omitted.

> * Zig's std lib data structures are incredibly useful, especially compared to the C++ STL. I think elaborating on this could make for a very interesting article. :-) (I have a guess already at one item, which is MultiArrayList, something that kind of blew my mind when I first learned about it, and is in my opinion a very impressive testament to both the power and ease of use of Zig's approach to compile-time comput…

I didn't even know about it until today, very impressive. Generic SoA in less than 500 lines of userland code... https://github.com/ziglang/zig/blob/master/lib/std/multi_arr...

SoA in C++ isn't that long, here's my version (which for sure does not have the utility functions defined here though, but is useful enough for me): https://github.com/celtera/ahsohtoa/blob/main/include/ahsoht...

Re: Zig is now self–hosted by default

#112
post #42

Earlier quoted context omitted.

I didn't even know about it until today, very impressive. Generic SoA in less than 500 lines of userland code... https://github.com/ziglang/zig/blob/master/lib/std/multi_arr...

SoA in C++ isn't that long, here's my version (which for sure does not have the utility functions defined here though, but is useful enough for me): https://github.com/celtera/ahsohtoa/blob/main/include/ahsoht...

That's pretty sweet, I didn't know C++ could do this now!

Zig's still got it beat handily in simplicity though -- I think what's really cool about Zig's idea of comp-time evaluation is you get something like the power of C++ with something like the simplicity of C.

Re: Zig is now self–hosted by default

#113
post #110
post #109

Earlier quoted context omitted.

The fact that constant-folding is hard because the C language doesn't have portable semantics for basic things like integer addition (with overflow) is just braindead.

Yes, there are lots of optimizations that are hard in C and only possible thanks to UB abuse.

I feel like C screwed up cross-compilation so badly that people think it is hard for some reason. Which it obviously isn't. The Virgil compiler just includes all of its backends in builds for all of its hosts. There's nothing special about the host machine.

Re: Zig is now self–hosted by default

#114
post #105

Earlier quoted context omitted.

> Zig produces smaller, faster binaries than C++ This seems fairly significant to me and makes me wonder how this is possible with all the effort that has gone into optimizing C++

Because they can't do breaking changes and must live with legacy baggage. While zig can work use modern techniques without such issues

This is wrong because you can strip out C++ code you don't need. Green code doesn't need to worry about legacy baggage

Re: Zig is now self–hosted by default

#115
post #105

Earlier quoted context omitted.

Because they can't do breaking changes and must live with legacy baggage. While zig can work use modern techniques without such issues

This is wrong because you can strip out C++ code you don't need. Green code doesn't need to worry about legacy baggage

And how do you identify the unneeded code in a compiler?

Which is used all over the world?

Post reply on HN