Hacker News new | past | comments | ask | show | jobs | submit login
The Zig and Go Programming Showdown (erikexplores.substack.com)
12 points by teichmann on Oct 28, 2022 | hide | past | favorite | 12 comments



Go handles concurrency via goroutines whereas in Zig... I couldn't find any available information. All it says in their docs "it's an area of active research".


Thank you for asking!

Zig has stackless coroutines, I wrote a blog post that explains how it all works at a high level:

https://kristoff.it/blog/zig-colorblind-async-await/


"I think goroutines are preferable in that context because async/await is a much lower level tool that is easy to misuse, but when it comes to writing code with critical requirements of correctness and efficiency, you need async/await and you need Zig’s philosophy that we all should strive to write robust, optimal, and reusable software."

I don't see how this follows. Async/await is a disaster in every way, M:N threading (which Goroutines are an implementation of) is the way to go. Not only does one get sane concurrency but also parallelism. Look at Ada tasks and Erlang processes for writing parallel code with critical requirements of correctness and efficiency.


Goroutines (and stackful coroutines in general) require a runtime. Go has to sprinkle suspension points everywhere in the machine code (to prevent starvation) and when it needs to grow a goroutine stack, it also needs to know how to adjust every single relevant pointer in the entire program's memory to point to the new stack location.

This is not something that a systems programming language would want to do. I agree with your point that structured concurrency is good and preferable for high-level languages, but it's not an absolute better choice when you start thinking about the details, like you have to do in a systems programming language.


Agree, while I prefer the Go model from a usability perspective, I don't think that is the way to go for a language such as Zig. Zig seems to have done a really good job within the boundaries set by a language which aims for minimal level of abstraction.


Hey this article is paywalled. How are all of you discussing it?


Is it? I can open it even without an ad-blocker. Try deleting your cookies for the website. They might allow only a limited number of free articles to read.


It is paywalled. When you scroll down you have to subscribe to keep reading. The section "What Made Me Nearly Give Up on Zig" is closed behind a red big banner that says "keep readying with a 7 days trial".

To the thread creator: Please just stop, no one wants to subscribe to read your opinion, experience on certain languages


I am actually the author, and I didn't start this thread. People have to decide for themselves whether it is worth reading or not. Lots of people subscribe to Substack to read experiences, opinions on various subjects.

Nobody will put in the effort to write these kinds of articles over time unless they can make some money on it either through subscriptions or ads. Personally I trying to find a balance by letting people read quite a lot for free, so it is worthwhile to look. Subscription can be had for free on a trial period, so you can can try reading my stories and see if it is worth it and cancel before you got to pay.

It is a certain mark of entitlement that people think they should be given all the content in the world for free without paying for it. Why should writers do all their work for free? You expect to walk into a magazine store or bookstore and grab whatever stuff you want for free and walk out?

Of course not. Content creators have to mix free and paid to make things work. One writes free stuff for marketing but you cannot only do that. Most people don't live of trust funds ;-)


> Nobody will put in the effort to write these kinds of articles over time unless they can make some money on it either through subscriptions or ads.

That's fine. Please stop doing it.


Isn't there a 'let me keep reading' button on these substack popups?


You can sign up for a free trial and cancel before any payment is required. I know that can be annoying, but as a writer you have to have some way of getting people interested in trying a subscription. Not easy to find a good balance for both readers and writers.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: