Skip to content

Error model specification

  • No exceptions and no hidden control flow.
  • Errors are expressed explicitly as Option[T] (per language spec).
  • Runtime panic is reserved for unrecoverable faults.

This chapter defines runtime-side failure behavior at execution boundaries. Language-level error typing remains canonical in docs/spec/error-handling.md.

  • Functions return Option[T] when errors are expected.
  • Callers must explicitly handle none.
  • No implicit propagation (?-style) unless the language introduces a specific operator later.
  • panic(msg) is a runtime builtin.
  • Lowering inserts a call to panic for unrecoverable runtime conditions (e.g., bounds checks if enabled).
  • panic terminates execution (trap).
  • Compile-time errors are reported via semantic diagnostics (HIR stage).
  • Runtime errors use panic with message + span context when possible.
  • Defining source-language syntax for error handling forms.
  • Defining build/deployment policy for backend artifacts.