Closed
Description
the type of:
const foo = switch (bar()) {
A => a(),
B => b(),
C => c(),
}
is some type that each of a()
, b()
, and c()
either are or can implicitly convert to. Determining this type is called peer type resolution. That's already a solved problem.
The @typeOf()
builtin function should take multiple parameters and do peer type resolution on them to expose this concept directly to users.
This is useful in this context:
fn max(a: var, b: var) -> @typeOf(a, b) {
if (a > b) a else b
}