You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What's happening here is that, by exploiting forward type information from x the ? operator attempts to resolve by pulling out the desired item, otherwise return what is left from the enclosing function. For that to type check, what's left must fit into the return type.
This then allows us to encode exceptional control flow roughly as is done in Rust.
The text was updated successfully, but these errors were encountered:
The type switch operator is inspired by the
?
operator in Rust. Some points:?
operator is inextricably linked withstd::error::Error
and is used for error propagation.In particular, since we have union types in Whiley, the
?
operator should work with them. For example:What's happening here is that, by exploiting forward type information from
x
the?
operator attempts to resolve by pulling out the desired item, otherwisereturn
what is left from the enclosingfunction
. For that to type check, what's left must fit into the return type.This then allows us to encode exceptional control flow roughly as is done in Rust.
The text was updated successfully, but these errors were encountered: