Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Context API with Transact and Accumulator #97

Merged
merged 6 commits into from
Feb 17, 2019
Merged

Conversation

bartelink
Copy link
Collaborator

As pointed out with great patience by @eiriktsarpalis in internal reviews, the Context API (which was arrived at by me in migrating diverse implementations to a common API style) was not a good default programming model (as evidenced by "if you're explaining, you're losing" in #86) for many reasons including at least:

  • it has temporal APIs regarding accumulating events, which is not the commonly needed case
  • has debatable names (Execute vs Decide) and abstractions that don't generalize

This is replaced with a more direct surface level API:

  • Handler.Transact(interpret: 'state -> 'result * 'event list) : Async<'result>

Even though this arguably makes some handlers less legible, the benefit is that the above API takes far less explaining, and does not rule out any scenarios.

The Accumulator type remains for porting purposes, but is not important to understand and may be deprecated in the future depending on other feedback.

@bartelink bartelink merged commit 6938688 into master Feb 17, 2019
@bartelink bartelink deleted the transact branch February 17, 2019 12:57
bartelink added a commit that referenced this pull request Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant