Open
Description
The following showcases a generic pair implementation and how it could be used:
Some backends might support generics natively (Rust, Java). For now, this information will be erased to maximize support with as little effort as possible. It might be possible to provide the generic information as well so that it can be used. Alternatively this could be performed in a late translation step, making it possible for backends to decide if they need to perform erasure or not.
tuple Pair<L, R> {
left: L;
right: R;
}
type Entry {
p1: Pair<string, u32>;
p2: Pair<string, string>;
p3: Pair<string, string>;
}
This would be syntactically translated into the following:
tuple PairStringU32 {
left: string;
right: u32;
}
tuple PairStringString {
left: string;
right: string;
}
type Entry {
p1: PairStringU32;
p2: PairStringString;
p3: PairStringString;
}