Live data from Hacker News

Zig: Upcoming release postponed two more weeks and lacks async functions

ziglang.org

11–20 of 62 posts

Re: Zig: Upcoming release postponed two more weeks and lacks async functions

#11
post #4

Why Async, especially considering Zig intends to be something like a High Level "portable Assembly"?

Zig's async implementation is the best of any languages, because you can run them without an event loop and in that case they will be simply synchronous. This completely eliminates the function coloring problem.

Re: Zig: Upcoming release postponed two more weeks and lacks async functions

#12
An engineer being overly optimistic with a time estimate? Say it ain't so!

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto

The same goes for features. I'd rather Zig have a delayed/good async next year and forever after, instead of a rushed/bad async right this moment and forever after.

Re: Zig: Upcoming release postponed two more weeks and lacks async functions

#13
post #4

Why Async, especially considering Zig intends to be something like a High Level "portable Assembly"?

Zig's async implementation is the best of any languages, because you can run them without an event loop and in that case they will be simply synchronous. This completely eliminates the function coloring problem.

Usually the coloring problem IME goes the other way: you want to run a synchronous/blocking function in an async context. How does Zig deal with that?

Re: Zig: Upcoming release postponed two more weeks and lacks async functions

#14
post #4

Why Async, especially considering Zig intends to be something like a High Level "portable Assembly"?

Zig's async, like Lua's, lets people write libraries that are generic over async-ness by default. "dump my registers and jump to another stack" is also a legitimate move in assembly (though that's not how this implementation actually works).

I understand the technical reasons (caused by cultural reasons) why Python ended up with colored async but man oh man was it a bad choice for a high-overhead language to do that…

Re: Zig: Upcoming release postponed two more weeks and lacks async functions

#15
post #4

Why Async, especially considering Zig intends to be something like a High Level "portable Assembly"?

Zig's async implementation is the best of any languages, because you can run them without an event loop and in that case they will be simply synchronous. This completely eliminates the function coloring problem.

Does that mean the return types are the same when you use async or not on the same function?

Re: Zig: Upcoming release postponed two more weeks and lacks async functions

#16
post #4

Why Async, especially considering Zig intends to be something like a High Level "portable Assembly"?

Waiting for IO is never cool. Also, zig's version of async is pretty low level and still obeys the no hidden control flow mantra (at least how it was implemented until 0.9.0).

How was it implemented in the past? Is there any overview of the design iterations Zig has gone through?

Seems like Rust is still working on this area with the controversial keyword generics

Re: Zig: Upcoming release postponed two more weeks and lacks async functions

#17
post #13

Earlier quoted context omitted.

Zig's async implementation is the best of any languages, because you can run them without an event loop and in that case they will be simply synchronous. This completely eliminates the function coloring problem.

Usually the coloring problem IME goes the other way: you want to run a synchronous/blocking function in an async context. How does Zig deal with that?

Function calls?

Re: Zig: Upcoming release postponed two more weeks and lacks async functions

#18
post #15

Earlier quoted context omitted.

Zig's async implementation is the best of any languages, because you can run them without an event loop and in that case they will be simply synchronous. This completely eliminates the function coloring problem.

Does that mean the return types are the same when you use async or not on the same function?

No, there still are sync and async versions of functions. Zig just implicitly chooses which version to run and implicitly inserts await points. There's still a runtime and event loop if you use async. It's an async like in any language, but it relies on compiler magic instead of having locally explicit syntax.

Re: Zig: Upcoming release postponed two more weeks and lacks async functions

#19
post #16

Earlier quoted context omitted.

Waiting for IO is never cool. Also, zig's version of async is pretty low level and still obeys the no hidden control flow mantra (at least how it was implemented until 0.9.0).

How was it implemented in the past? Is there any overview of the design iterations Zig has gone through? Seems like Rust is still working on this area with the controversial keyword generics

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

Re: Zig: Upcoming release postponed two more weeks and lacks async functions

#20
post #18
post #15

Earlier quoted context omitted.

Does that mean the return types are the same when you use async or not on the same function?

No, there still are sync and async versions of functions. Zig just implicitly chooses which version to run and implicitly inserts await points. There's still a runtime and event loop if you use async. It's an async like in any language, but it relies on compiler magic instead of having locally explicit syntax.

One can check this via static analysis as the complete code tree can be inferred with relative ease (only package paths and usingnamespace are depending on comptime) + third party code will be able to query compiler info, so I do not expect this to be a big problem once static analysis symbols can be enforced as unique (see https://github.com/ziglang/zig/issues/14656#issuecomment-143... and follow-up for the use cases of static analysis tooling). Also, since there is currently no problem: YAGNI and solve it once a use case comes up.
Post reply on HN