Renderingen-US

Experimental through version 1. Version 0 was alpha. This is the first language release: the interface is relatively stable, not frozen. Nothing is promised stable until version 2.

Error channel

Keyword spelling

Failure is a second channel, not a wrapper type and not an exception that unwinds past you. A function that can fail writes ⇥ after the success type: → i32 ⇥ string returns an integer or fails with a string. throw sends a value on that channel. do / catch is the local boundary around a call that might fail; catch binds the error as an ordinary value.

throw if is the guarded form. require and reject (listed with statements) compile to the same idea: throw when a condition fails, or when it holds. A call to a ⇥ function sits inside an active do / catch (or another statement that carries catch).

fn divide(i32 a, i32 b) → i32 ⇥ string {
    if b ≡ 0 {
        throw "division by zero"
    }
    return a / b
}

main {
    do {
        print divide(7, 2)
    }
    catch err {
        print err
    }
}

Return to the grammar overview.

Terms#

These are the words you write in this part of the language. Each links to its page. The second column names the grammar rule the word belongs to.

TermGrammar rule
throw, paniciace_expr
throw, panic, ifiace_guarded_expr
catchcape_clause

Formal grammar#

The rules for this part of the language are the parser's own definition of it. They are written for models and tools, so this page does not repeat them; the full list is at every production.