Open
Description
This is something that in the beginning I thought is a modeling problem, but I'm starting to find situations that make me wonder.
Example, we have action1
, finish_action1
, action2
action1
returns an effect that does something (maybe something as innocent as reading a time-stamp) and dispatchesfinish_action1
, eg:
[](auto&& ctx) { ctx.dispatch(finish_action1{}); }
action2
does something, that can be dependent on state touched byfinish_action1
.- The user does:
dispatch(action_1{});
dispatch(action_2{});
The execution we get is however action_1
, action_2
, finish_action1
, even if maybe one could expect (or require for correctness): action_1
, finish_action1
, action_2
.
One solution would be to ensure that the effects from an action an all actions dispatched within it gets queued before any other actions in the queue. The implementation seems not trivial and can add a small overhead also in cases where it may be not necessary, since it requires keeping a nested queue for actions dispatched within the effect.
Considertions are:
- Should we put this aspect of queueing in the
event_loop
interface? - Should we add a method
dispatch_nested()
to consider this special scenario?
Metadata
Metadata
Assignees
Labels
No labels