Error handling ============== This code could trigger an error, and should not be allowed: func div(int p, int q) -> int { return p/q } This code does the divison in a "risky"-block, and is allowed: func div(int p, int q) -> int { risky .divbyzero { return p/q } } This function catches divison by zero and returns 0. func div(int p, int q) -> int { risky .divbyzero { return p/q } else { return 0 } } The behavior of this function depends on the configuration of the arena. It could catch divison by zero and return 0, or it could simply generate an exception. (I.e. the behavior of "softfail" depends on the configuration) func div(int p, int q) -> int { risky .divbyzero { return p/q } else { softfail .divbyzero return 0 } } # Alternative syntax # (this could be confusing though, because errors in # nested function calls can't be catched this way) func div(int p, int q) -> int softfail 0 { risky .divbyzero { return p/q } } # Alternative syntax 2: func div(int p, int q) -> int { risky .divbyzero { return p/q } softfail { return 0 } } Exceptions in functions without an arena-parameter -------------------------------------------------- - Should this be supported at all? - Or should it be required to handle all possible exceptions? - Should there be some kind of "default arena" for each thread / call stack? --> Require "risky .X or .e" syntax: func div(int p, int q) -> int or MathError { # From "error Risky" to "error MathError" risky .divbyzero or .div_by_zero { return p/q } } Manually generating an error code --------------------------------- enum StuffError { invalid_parameter } func do_stuff(int cost) -> int or StuffError { if cost < 0 { error .invalid_parameter } return cost }