-
Notifications
You must be signed in to change notification settings - Fork 3
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
Carrier type for Choose and Offer; lift Choice<N> restriction #98
base: main
Are you sure you want to change the base?
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.
Finally reviewing through all this: overall, looks great! Clean implementation, clear documentation. Well done :)
My only large change request is: it seems preferable to have the Carrier
type be the second argument to Choose
and Offer
, with a defaulted type, so that error messages containing the usual Choose
and Offer
types with Choice
s don't get more cluttered, and code that does not use the Session!
macro is backwards-compatible.
In order to achieve this defaulting, we'd need a trait to get the Choice<N>
for a given tuple's arity, so, e.g. Offer
can be Offer<Choices, <ChoiceForArity<Choices>>::Choice>
or some such. What are your thoughts about this change?
There are also some conflicts with main
now, largely due to changes to the definitions of Offer
and Choose
so as to make their constructors private.
I don't see an issue with that kind of defaulting, as long as Rust doesn't get confused by having a default type parameter depend on a non-default one. There will have to be an obvious limit on the maximum tuple arity for such. |
This also constitutes a breaking API change to Dialectic, so should be a minor version bump (since we're pre-1.0). |
To implement the changes suggested above, there are several steps:
|
It also looks like docs + clippy fail on this PR.
I'm on rustc & cargo 1.56, in case it's version-specific. |
No description provided.