Earlier quoted context omitted.
Zig's async manages the coroutines intrusively: It generates the state machine type, you provide the memory for where an instance of one runs, and you manage resuming it until completion. Similar to Rust's Futures, it's pretty unopinionated in how you manage them so it works everywhere (i.e. freestanding). Could you clarify (or provide more reading on) how the other systems like delimited continuations, algebraic eff…
> Could you clarify (or provide more reading on) how the other systems like delimited continuations, algebraic effects, and monads differ from Zig async + how they could be adapted in a similarly unopinionated/low-level way? The key requirement for all these is an ability/API to defer and resume execution (indeed, delimited continuations are sometimes described as "resumable exceptions"). In higher-level languages we…
Zig: Upcoming release postponed two more weeks and lacks async functions
51–60 of 62 posts
Re: Zig: Upcoming release postponed two more weeks and lacks async functions
#52Re: Zig: Upcoming release postponed two more weeks and lacks async functions
#53> I’m not on Twitter anymore - my goal is to instead channel that micro-blogging energy into regular blogging energy on my personal website as well as posting Zig project news here on ziglang.org. Cool, I like this! I realized last year that I was investing too much time into sharing things on Twitter that I'd subsequently forget about or be unable to find. Instead, I created a separate section on my personal blog fo…
To make it as convenient as possible (every amount of friction would eat at my motivation) I made it using Obsidian Digital Garden [1]. It's a bit of a hassle to set up and the UI is annoyingly bad but it's pretty convenient (boils down to click to publish) afterwards.
Re: Zig: Upcoming release postponed two more weeks and lacks async functions
#54Earlier 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.
It absolutely doesn't, because it changes the semantics of what's being called, introducing deadlocks.
Re: Zig: Upcoming release postponed two more weeks and lacks async functions
#55Earlier quoted context omitted.
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?
They have await keyword. This is noop in sync mode
Re: Zig: Upcoming release postponed two more weeks and lacks async functions
#56Earlier 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.
It absolutely doesn't, because it changes the semantics of what's being called, introducing deadlocks.
"Async functions can be called the same as normal functions." Only when you have an event loop, the order async functions are running might be different because of the scheduling, but everything else is the same.
Re: Zig: Upcoming release postponed two more weeks and lacks async functions
#57Earlier quoted context omitted.
Sure, but this is also what defer is for. There isn’t implicitly called destructors because the languages mantra is “no hidden control flow”. RAII et semantics is almost entirely hidden control flow that you just have to “know”. Lots of people hate when they need to “just know” things to fully parse the code they’re reading. You’re free to dislike those decisions, of course. Personally, I like the target of no hidden…
I have a love/hate with this. The big problem with defer/errdefer is that I have no way to mark a function as "This function always needs a defer after it and the compiler needs to yell at me if it doesn't exist." It's also sometimes really hard to scope your defer/errdefer correctly. You may have to twist your code inside out because defer/errdefer ends at a block scope while your variable may not (via: "break :blk…
Re: Zig: Upcoming release postponed two more weeks and lacks async functions
#58Why Async, especially considering Zig intends to be something like a High Level "portable Assembly"?
Re: Zig: Upcoming release postponed two more weeks and lacks async functions
#59Earlier quoted context omitted.
Huh? Lots of language do not have guaranteed to be called at a specific time “destructors”. Additionally, zig provides this functionality with defer and errdefer, giving you the ability to explicitly call a function at the end of scope.
> Lots of language do not have guaranteed to be called at a specific time “destructors”. Those tend to be GC languages though, where deterministic execution is not a hard requirement.
Re: Zig: Upcoming release postponed two more weeks and lacks async functions
#60Why 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.