nemo icon indicating copy to clipboard operation
nemo copied to clipboard

Macros that can ergonomically expand to a full protocol definition

Open ebfull opened this issue 10 years ago • 1 comments

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>>
                                                        >
                                                >
                                         >
                                    >
                               >
                          >
                     >
                >
           >

ebfull avatar Oct 23 '15 13:10 ebfull

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.

ebfull avatar Oct 24 '15 17:10 ebfull