So I am new to Zig and trying to learn it through Ziglings exercises.
I am trying to come across the async exercise, however in each correction of the exercise that I see, I am doing the exact same thing, however, here is what the compiler has to say:
xercises/084_async.zig:51:18: error: async has not been implemented in the self-hosted compiler yet
_ = async foo();
~~~~~~~~~^~
referenced by:
callMain: /snap/zig/8241/lib/std/start.zig:564:17
initEventLoopAndCallMain: /snap/zig/8241/lib/std/start.zig:508:34
remaining reference traces hidden; use '-freference-trace' to see all reference traces
And here is my code, minus the comments:
const print = @import("std").debug.print;
pub fn main() void {
// Additional Hint: you can assign things to '_' when you
// don't intend to do anything with them.
_ = async foo();
}
fn foo() void {
print("foo() A\n", .{});
suspend {}
print("foo() B\n", .{});
}
What is wrong with what I have done ? Thanks.
AFAICT ziglings meant to be used with a development build of
zig, not stable: From the ziglings/exercises repo linked above:Note: I'm also new to zig, working through these myself and haven't gotten to async yet, but I could not get exercises to compile correctly on stable. (0.11.0 at time of writing)