I would like to use Chaiscript
to let users of my application implement tasks or stateful algorithms by using a scripting language. These algorithms "depend on events during time". In other words, the algorithms, which are scheduled by the application, should be allowed to yield
their execution at any time and to resume
whenever an event they are interested in occurs (in which case the task is rescheduled for resumption). What kind of support does Chaiscript
provide to achieve this?
Coroutines or Stateful/resumable tasks with Chaiscript
319 Views Asked by Martin At
1
There has been various discussions surrounding the implementation of co-routines and similar, but nothing has been implemented yet.
See here: http://discourse.chaiscript.com/t/co-routines-in-chaiscript/33 And here: https://gitter.im/ChaiScript/ChaiScript?at=5557ceac076ab5646e6de3e8
Depending on your exact needs it might be possible to have your function return its own continuation. A pair of
(value, function_to_get_next_value)
, since chaiscript does easily support passing of function objects and lambda