Skip to content
Beskid The Beskid Book

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

07.3 Option and nullability

Option T is the only optional surface—no null, no optional keyword."

Option and nullability

If you type null expecting sympathy, you will receive diagnostics instead.

Optional presence must use Option<T> (corelib Query.Contracts.Option) or an explicit enum with a dedicated absent variant at API boundaries.

  • Forbidden: null, optional keyword, ?T sugar
  • Present / absent: Option<T>::Some(x) / Option<T>::None (exact constructors per corelib)

null made billion-dollar bugs feel normal. Beskid chooses explicit enums so absence shows up in match, not in a surprise NRE at runtime.

Use match on options (see enums and match). Calling methods on a maybe-absent value without narrowing is a compile error—not a Friday production mystery.

flowchart TD
  V[Value] --> M{match Option}
  M -->|None| H0[handle absent]
  M -->|Some| H1[use inner T]

Functions and methods