3 ms·
No if anything it solves that. It's inversion of control.. the caller chooses the bahavior not the callee. Using async/await as an example, you have to have an
by seabrookmx 3y ago
No if anything it solves that. It's inversion of control.. the caller chooses the bahavior not the callee.
Using async/await as an example, you have to have an async implementation (red) of a function and a non-async implementation (blue). In this case, the callee chooses the behavior.
If instead you had a function that took some sort of runtime as a parameter that it could use to run downstream code synchronously or asynchronously, then you'd have something comparable to Zig's allocator. The red and blue functions would instead be one function where you pass a different runtime.