points by simonask 1 day ago | 0 comments
As far as I understand it, the idea is that the IO interface is "magic" in the sense that it affects which version of a function gets called: either the synchronous, linear version, or the asynchronous, stackless, suspensible state machine version.
This has a lot of implications, especially for function pointers and other forms of dynamic dispatch.
My personal take is that async code is fundamentally different from sync code, because the weights of various tradeoffs change dramatically. In my view, "colorless" functions are not really a worthwhile goal in the first place. But I've been wrong before, so it may turn out to be great, we'll see.
[–] lukaslalinsky 1 day ago
[–] elcritch 1 day ago
Yeah so that's a lot of hidden magic and implicit logic. ¯\_(ツ)_/¯
[–] Zambyte 1 day ago
[–] tialaramex 1 day ago
If you look at how it's implemented you can see that the classic "XOR a register with itself to zero that register" trick is in fact basically free in a modern CPU rather than using up the ALU because of how register renaming is implemented. But hopefully we're not pretending that "You could buy the CPU vendor's technical manuals" makes this now explicit.
[–] weebull 1 day ago
[–] Zambyte 1 day ago
[–] lukaslalinsky 1 day ago
[–] boomlinde 1 day ago
[–] imtringued 1 day ago
The only real question you should have is, how does the "non-blocking" case work when the interface is still a synchronous call? Well, the answer is quite boring... You just call into the scheduler and it runs the other task inside the blocked operation.
I was promised hidden magic and implicit logic! Now I want a refund!
[–] maleldil 1 day ago
[–] lukaslalinsky 1 day ago