-
Notifications
You must be signed in to change notification settings - Fork 59
Clad improvements #1174
Clad improvements #1174
Conversation
b77503c to
e412bf8
Compare
belisarius222
left a comment
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.
It looks like this assumes a backward list of moves to emit, but then punts the reversal of the moves to something outside the clad interpreter. I feel like this behavior should be at least mildly documented -- and if my understanding of this behavior is wrong, it should definitely be documented!
|
The code itself looks good, though, so I'll approve this once I understand the move flopping. |
|
The flopping outside of |
joemfb
left a comment
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
|
Yes, the interpreter produces a list of moves in "natural order". A list of moves is in natural order if we expect the head of the list to be the first move evaluated. It's common in cores to internally keep moves in reverse order and flop it at the end because that makes it easier to add a single event to the end of the list. If you're doing that, you should be very careful and should perhaps document it. But if we see something accept or produce a list of moves, we assume that it's in natural order. If you're storing moves in natural order (uncommon in cores), then If you're storing moves in reverse order, as in In both cases, you could define We usually store moves in reverse order, but this should be entirely abstracted away by |
Feel free to merge this one into #1169, given the fellas' reviews -- I can merge the whole clay & clad goodness into master tomorrow. Or since you know I plan on doing it anyway, you can. 😄 |
|
Will do so once @belisarius222 is satisfied with the move order. |
belisarius222
left a comment
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. Move order looks correct
Two changes:
|verb.+clad. Now,+take:eval:claddeals with the specifics of the monad (eg accumulating effects, implementing the%conthandling that ensures the associativity of+bind, etc). Thus,+take-commitand+take-mergeonly have to deal with the imperative parts (fetching the transaction from our global state and writing it back) and the results when the transaction finishes.Additional generalizations that I expect to happen at some point:
Generalize
+cladto be completely non-specific to Clay, and move it into zuse. I think all that's necessary is parameterizing themove,sign,note, andinputtypes.Make a core that manages all running transactions within one opaque piece of state, so you don't have to duplicate
+take-mergeand+take-commit.These will happen as soon as I have a good reason to do them, because I don't believe in generalizing without an external reason to do so.
Note: this is targeted against #1169 because I didn't want to push new features directly to #1169 because it's already been reviewed. I also don't want to interfere with #1169 hitting master -- that shouldn't be blocked on this PR.