News for hackers. Stuff that matters.
Re:I Believe Zig Has Function Colors by lostmsu on Saturday April 09, 2022 @12:38PM (#30969524)
OK, maybe I need to rephrase my question: if I do this in main, am I guaranteed to have "main" printed after "foo() is finished"

    foo();
    std.log.info("main", .{});
Re:I Believe Zig Has Function Colors by kristoff_it on Saturday April 09, 2022 @06:17PM (#30972664)
That's how it works in Zig. Calling an async function like this will also await it.
Re:I Believe Zig Has Function Colors by mkishi on Saturday April 09, 2022 @06:40PM (#30972861)
Could you share an example? I thought async functions weren't callable outside an `async` invocation from the `Inline` calling convention.
Re:I Believe Zig Has Function Colors by DixieDev on Saturday April 09, 2022 @09:22PM (#30973666)
Within main(), your snippet will give you an error at compile time "function with calling convention 'Inline' cannot be async". In my snippet foo() is invoked in an async context using the async keyword, and when foo() suspends (due to it awaiting bar()) control will be returned to main(). If you change your first line from

  foo();
to

  _ = async foo();
Then your program will compile and your log is not going to be prevented by Zig's async shenanigans.
Re:I Believe Zig Has Function Colors by samatman on Saturday April 09, 2022 @01:35PM (#30970070)
I would consider that necessary, but not sufficient, to call a particular async system "good", yes.