-
Notifications
You must be signed in to change notification settings - Fork 54
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
Ability to provide extra fields #70
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I like the idea, don't think we need to care about the breaking change, as you mentioned this add new functionality, and we can cut a new breaking version using SEMVER.
# Code to simulate and force an exception inside a | ||
# guard function. | ||
if Map.get(struct, :force_exception) do | ||
IO.inspect "raising" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing inspect 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops! sorry 😄
Fixed conflicts, will review and merge later today, cut a new version later in the week probably since there were other PRs merged as well |
@joaomdmoura do you still intend to merge this PR? Was checking the PR and Thanks! |
@joaomdmoura is there any chance of this PR be merged? |
@joaomdmoura are you planning on still maintaining this library? If not, I'd be happy to take over maintenance. |
I'm picking up the work on this one oh #85 , I decided to go with another implementation that wont brake any implementation for current projects using this that decide to update. Because of that I'm closing this in favor of the other one. |
I'm trying to incorporate this into a current project. I'm having a problem though. I want to provide atomic transitions where additional fields are required.
E.g: when transitioning from state A to state B, field "extra" is needed on the struct, but I want to update both fields (
:state
and:extra
) in a single query.This PR is based off of the work @TalkingQuickly did on #54 , but goes a bit further. I added an
extra
field (defaulting to%{}
) to all operations, and that allows me to do this:However, this is a slight breaking change, since all the overridable functions now receive an extra argument. Even though it can be ignored, that requires updating existing state machines to include it
However it feels like a safe enough change that provides abilities not possible with the current API
PS: I haven't updated the readme or the documentation yet. I'll wait for feedback on this change before proceeding with that