4 ms·
Posix has getcontext / setcontext and you can probably use/bind pcl [0] to wrap that properly. Boost has boost::context [1]. For an example of a binding to pcl
by touisteur 5y ago
Posix has getcontext / setcontext and you can probably use/bind pcl [0] to wrap that properly. Boost has boost::context [1]. For an example of a binding to pcl you can look up ada-generators [2] which I use heavily (but am not the author).
I've hard a hard time using continuations in languages with not-total capture. Ada has package variables (similar to singleton without the headache) that are not captured by call/cc libraries... There's also the secondary stack (specific to GNAT, not sure) for functions that return objects of unknown size at call site, which also are a pain to capture/restore... Good luck with those.
I think continuations, to be really footgun-less, need to be integrated in the language & runtime, so that when you need to serialize the current state you can 'capture all the things'. A bit like python with its generator/automaton approach.
[0] http://www.xmailserver.org/libpcl.html http://www.xmailserver.org/libpcl.html
[1] http://www.devdoc.net/c/boost-1.65.1/libs/context/doc/html/context/cc.html http://www.devdoc.net/c/boost-1.65.1/libs/context/doc/html/c...
[2] https://github.com/pmderodat/ada-generators https://github.com/pmderodat/ada-generators