Hacker News new | past | comments | ask | show | jobs | submit login

What about a more imperative shape? What if you could have a closure that "goto"s into the parent function scope?

Or imagine coroutines built with `swapcontext` (man 3).




Stackful fibers are an anti-pattern. See Gor Nishanov's review for the C++ ISO committee http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2018/p136... linked from https://devblogs.microsoft.com/oldnewthing/20191011-00/?p=10... . Notice how it sums things up:

> DO NOT USE FIBERS!


Let's say that not everybody agrees. Also all the issues identified by Gor are due to retrofitting continuations into an existing language as a pure library without compiler help.


Can Gor Nishanov post one of his hand-made state machines that handles several nested protocols? Or does he believe that operating systems are good at scheduling work across 100,000 threads?


Huh? That might be exactly how "effect handlers" are implemented.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: