A list of expressions is defined by e % sep which is equivalent to e (sep e)* in term of parsing but not equivalent in term of types. Indeed the first expression will have the type Vec<E> while the second (E, Vec<E>) or (E, Vec<(E, Sep)>) if the separator has a type different from () or (^).
e % sep has the type Vec<E> and sepmust have the type () (or (^)) or a typing error should be exposed.
A list of expressions is defined by
e % sep
which is equivalent toe (sep e)*
in term of parsing but not equivalent in term of types. Indeed the first expression will have the typeVec<E>
while the second(E, Vec<E>)
or(E, Vec<(E, Sep)>)
if the separator has a type different from()
or(^)
.e % sep
has the typeVec<E>
andsep
must have the type()
(or(^)
) or a typing error should be exposed.