3 ms·
> The language reference says that sync functions are turned async if they call async functions. This implies virality of async on functions, which implies that
by anonymoushn 4y ago
> The language reference says that sync functions are turned async if they call async functions. This implies virality of async on functions, which implies that many functions are definitely async-only.
> If the compiler does something different, which it would have to if it actually makes two different versions of each function, then the language reference is wrong. Like I said, accuracy matters, so I would also like to see changes in the Zig language reference about this if that's the case.
To be clear, do you expect this function
fn invokeFoo(a: anytype, b: anytype) @TypeOf(a) {
return a.foo(b);
}
to have only one representation at runtime, and for that one representation to be either async or not async?
- ghoward 4y agoThat's a generic function. That's not what I'm talking about.