Live data from Hacker News

Zig Is Self-Hosted Now, What's Next?

kristoff.it

71–80 of 159 posts

Re: Zig Is Self-Hosted Now, What's Next?

#71
post #65

Earlier quoted context omitted.

> I dunno if that's accurate? It's not, your understanding of async in Zig is sound. I would even add that in the blog post in question (my post, the one ghoward is replying to in his) I don't even dare to describe Zig as colorless, in fact I say colorblind .

> It's not, your understanding of async in Zig is sound. Then perhaps there is something wrong with the language reference? > I don't even dare to describe Zig as colorless, in fact I say colorblind. Doesn't that mean my blog post is right? But my biggest beef is that people, including GP, used your blog post to then claim Zig is colorless. I mean, GP did it in GP.

I don't really understand your crusade. I made this same observation in the past, it never satisfied you.

Your blog post is full of wrong information. I tried to explain to you what was wrong when you first posted it (so you can refer to those comments, if you want), but you keep seeing this as some kind of philosophical debate, and I have no interest in having this debate.

As I said to you already in the past, I just write software with Zig async and it works. Up to you what you want to do with your free time.

Re: Zig Is Self-Hosted Now, What's Next?

#73
post #62

Earlier quoted context omitted.

the source code was very well laid put from what i remember, and tests were particularly helpful for understanding how to use library code. i just didn’t feel like i quite had the knowledge to architect low level code in general, you must have picked up on that naturally

Of all the reasons I might imagine someone feeling like C is easier to pick up than Zig, "hardware-software knowledge to know how to architect low level code in general" does not make a ton of sense to me. In what way do you feel this was easier in C?

when i have an idea for a program i want to build, i struggle to express it in terms of structs, pointers, and C/zig’s language features. but with C, i can often find similar programs and find good examples of how to do what i want.

for example right now i’m working on an SDL/opengl app with an immediate mode gui, and there’s enough code in the wild for me to pour over to understand how and why they structure their programs

but when i started with zig i would often get stuck, unable to really understand the c code i was interfacing with and struggling with the language basics a bit

Re: Zig Is Self-Hosted Now, What's Next?

#74
post #38

I wonder if Zig is getting too much hype at the moment considering its immaturity (and so many easy to hit bugs as noted by other commenters). Is it getting hype before it's ready? Will it be able to recover from that?

Disclaimer: Not a Zig fan. I think Zig is getting too much hype. It's unfortunate because Zig could have potential, but hyping something before it's ready is a recipe for alienating early adopters and killing progress towards popularity. The worst part of it is that I've heard people say that they've got Zig in production; with all of the bugs in the compiler, they are apt to get burned, and too many burns will lead…

How would you expect a language as low-level as Zig is to support colorless async? It pretty much requires some kind of green threads.

Re: Zig Is Self-Hosted Now, What's Next?

#75
post #8
post #2

Nice achievement. Curious about this though: > building the compiler itself used to require 9.6GB of RAM, while now it takes 2.8GB. Why is the RAM usage so high? It was only a few years back and we were building C++ compilers on machines with barely 16MB.

> It was only a few years back and we were building C++ compilers on machines with barely 16MB. "A few years" seems like a serious understatement, but beyond that... compilers in the time period you're talking about weren't really doing optimizations, they were just shoveling assembly out the door. Doing very little work takes very few resources, but the resulting binaries were way slower than they could have been. A…

This is not the case, optimizing compilers were quite far along by the 16MB era. RISC relied on them, GCC was widely adopted due to optimizations, etc.

Re: Zig Is Self-Hosted Now, What's Next?

#76
post #58

I watched the linked talk by Andrew Kelly - super interesting stuff. I've played a bit with data oriented design in the context of implementing an ECS, but some of the topics he discusses take it to another level entirely, and it's very cool to see it applied, with measurable results, in a large serious project like a compiler. I have a lot of admiration for Zig, as I think it takes a very interesting approach to bei…

Well, while you are developing a language, in particular a system programming language like zig, having to write your compiler in zig is a great way to learn first hand what your users are complaining about. Normally if you dogfood your own creations, you experience them maybe an hour a day, but the compiler will be the number one tool when working on zig.

Re: Zig Is Self-Hosted Now, What's Next?

#77
post #3

Correctness please. Zig is a way too simple language to justify all the really easy to hit bugs. I'd give everything for a zig compiler that's 10 times as slow but actually compiles my code. Also testing infrastructure. Zig really needs fuzzing and property testing tooling build-in. Hitting stage 2 with arbitrary autogenerated zig code and IR, would have really helped detect regressions for example.

If bugs are your concern, then this upcoming release is good news for you. Total number of open bug reports is 1,124. However if we remove bugs labeled "stage1" - that is - bugs that are no longer applicable because this release changes the default compiler to the self-hosted one - then the number drops to 514. It would be a fair characterization to say that this release cuts the number of known bugs in half. We have…

The bug that's currently blocking me from any work using master is https://github.com/ziglang/zig/issues/12325

That's not really a bug related to unfinished features that might get replaced anyways, but simply one involving recursive structs with pointers between, i.e. linked lists.

Not detecting issues like these feels less like a "these parts are unfinished hence here be dragons" thing and more like a fundamental culture problem.

I'm fine with cutting myself every now and then with a sharp tool and cutting edge technology, but that can also be done while having a ever growing and mature core that promises at least some stability. The only alternative seems to be to pull a Hickey and work on it for two years without releasing anything.

Re: Zig Is Self-Hosted Now, What's Next?

#78
post #55

Earlier quoted context omitted.

> Saying that Zig does not have function colors because it hides them at compile time is a little disingenuous, in my opinion. Not to impugn your character, but I feel the same way about the points you're making. > So you admit that Zig does have function colors? Not in any meaningful way, no. Again, the runtime representation of async vs sync functions is unavoidably different, and has nothing to do with the languag…

> I dunno if that's accurate? It's not, your understanding of async in Zig is sound. I would even add that in the blog post in question (my post, the one ghoward is replying to in his) I don't even dare to describe Zig as colorless, in fact I say colorblind .

Thanks for confirming. So what does Zig actually do to execute async functions? Green threads in the background? An event loop? Is there documentation on the implementation?

Re: Zig Is Self-Hosted Now, What's Next?

#79
post #9
post #2

Nice achievement. Curious about this though: > building the compiler itself used to require 9.6GB of RAM, while now it takes 2.8GB. Why is the RAM usage so high? It was only a few years back and we were building C++ compilers on machines with barely 16MB.

Zig puts the whole project into a single giant compilation unit. This has some benefits, but one of the drawbacks as you note is memory usage for larger projects.

See also: MLton and whole-program compilation.

Re: Zig Is Self-Hosted Now, What's Next?

#80
post #78

Earlier quoted context omitted.

> I dunno if that's accurate? It's not, your understanding of async in Zig is sound. I would even add that in the blog post in question (my post, the one ghoward is replying to in his) I don't even dare to describe Zig as colorless, in fact I say colorblind .

Thanks for confirming. So what does Zig actually do to execute async functions? Green threads in the background? An event loop? Is there documentation on the implementation?

When you set `const io_mode = .evented;` the stdlib observes that value and

- flips I/O functions to evented mode, both by setting the correct flags when creating, say, a socket, and also by having `suspend` and similar keywords in the winning branch of some comptime conditional statements, causing the functions in question to become async also in the language.

- instead of directly calling into main at program start, it starts an event loop and schedules main on it

This is all userland stuff based on a convention, none of this is ingrained in the programming language itself and it could very well be that in the future things will have to be done in a more explicit way.

Async functions are single frames (as opposed to being green threads).

Post reply on HN