nemo
nemo copied to clipboard
Macros that can ergonomically expand to a full protocol definition
type Foo = protocol!(
Recv usize,
Send usize,
Nest {
Send usize,
Nest {
Recv usize,
Choose [
{ Escape Z },
{
Send usize,
Escape S<Z>
}
]
}
}
);
should expand to
type Foo = Recv<usize,
Send<usize,
Nest<Send<usize,
Nest<Recv<usize,
Choose<Escape<Z>,
Finally<Send<usize,
Escape<S<Z>>
>
>
>
>
>
>
>
>
>
Done, but now I need to do some trick that looks like this:
proto!(
Atm = {
Recv usize,
Send usize,
Fun = {
Recv i8,
Send i8,
End
}
}
);
produces:
type Atm = Recv<usize, Send<usize, Fun>>;
type Fun = Recv<i8, Send<i8, End>>;
edit: I don't really need this it'd just be nice.