Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Errors, allocation, and resource scopes

Recoverable failure is a value: Option represents absence and Result represents success or an error. ? propagates a failure through the enclosing function with ordinary cleanup. Allocating operations expose checked failures; fatal traps terminate without unwinding.

There are no exceptions. A try, except, raise, or finally statement is rejected with a hint toward Result:

def main() -> ():
    try:
        pass
`try` is not supported; Plenty has no exceptions: return `Result[T, E]`, propagate an error with `?`, and handle it with `match`

Destruction defines cleanup order. The entrypoint defines process exit status and reporting of a main error. std.error adds operation and path context around a typed error and reports it on standard error.