-
Notifications
You must be signed in to change notification settings - Fork 4
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
[transmit-case] Ergonomics for Choice<N>
bounds
#100
Labels
enhancement
New feature or request
Comments
sdleffler
added a commit
that referenced
this issue
Apr 12, 2021
sdleffler
added a commit
that referenced
this issue
Jun 2, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just dumping some thoughts from DMs into a more permanent location.
Currently the issue is that
Choice<N>
is treated specially when it cannot be, as it is quantifiedand the vast majority of types which will be sent via
TransmitCase
will not be. At current, theTransmitCase
impl forChoice<N>
is for all typesChoice<LENGTH>
for allconst LENGTH: usize
,given a
TransmitChoice
impl. If we keepTransmitCase
, add aNotChoice<T>
type used fortransmitting non-
Choice<N>
types, and then add animpl
forTransmitCase<NotChoice<T>>
where
T: Match + Transmittable, Self: Transmit<T>
and then sealTransmitCase
, we can provide twofunctions for
choose
which work forChoice<N>
andNotChoice<T>
. In this case it becomes veryclear how
Choice
and non-Choice
case choosing is so different; they are of different kinds,specifically one is a parameter of the
const usize
kind and the other is a type.However, unless we extend this sealed type distinction to the type-level session language, we are
now forced to have two different variations of the
offer!
macro. So I propose the following:Choose
andOffer
types toChoice<N>
andNotChoice<T>
.Session!
macro, which has the necessaryinformation to deal with this.
Match
forNotChoice<T>
transparently delegating to the wrapped value.Given this, the same
offer!
will happily work for both cases. And we would likely also be able tohave a single implementation of
choose
that works for both cases as well.The text was updated successfully, but these errors were encountered: