Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Consider using coroutines for top-level glue instead of DI #37

Open
effa opened this issue Aug 29, 2016 · 0 comments
Open

Consider using coroutines for top-level glue instead of DI #37

effa opened this issue Aug 29, 2016 · 0 comments

Comments

@effa
Copy link
Member

effa commented Aug 29, 2016

Every time the core needs something from the state, it can just ask for it, by yielding an effect. After the intent is completed, new state and an action record is yielded. It could look something like this:

def perform_intent(state, intent):
    intent_performer = perform(state, intent)
    step = next(intent_performer)
    while step.effect:
        data = resolve_effect(step.effect)
        step = intent_performer.send(data)
    return step.state, step.action
@effa effa added the question label Aug 29, 2016
@effa effa added this to the Distant future milestone Aug 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant