3 ms·
This is great information. Especially the libuv internals. The article uses longjmp to explain coroutines. The native stack is doing a lot of heavy lifting the
by matheusmoreira 3y ago
This is great information. Especially the libuv internals.
The article uses longjmp to explain coroutines. The native stack is doing a lot of heavy lifting there... What would the implementation look like if you reified the stack?
This aside also left me wanting more:
> Rust's async transforms a block of code into a state machine that is not run until you await it.
Would be interesting to read about the internals of that!
I recently asked a question related to all this on the new language implementation stack exchange.
https://langdev.stackexchange.com/q/3547 https://langdev.stackexchange.com/q/3547
- supriyo-biswas 3y agoThere is a 1:1 correspondence between a generator/coroutine and an iterator with internal state. I suggest looking at the PHP generator RFC[1] and Concurrency from the Ground Up[2] talk. [1] https://wiki.php.net/rfc/generators https://wiki.php.net/rfc/generators [2] https://m.youtube.com/watch?v=MCs5OvhV9S4 https://m.youtube.com/watch?v=MCs5OvhV9S4
- kitd 3y agoIndeed. The fundamental concept is "Algebraic Effects" https://stackoverflow.com/questions/49626714/what-does-algebraic-effects-mean-in-fp https://stackoverflow.com/questions/49626714/what-does-algeb...