Skip to content
Beskid The Beskid Book

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

07.2 Types and generics

Nominal types, generics, references—without null or optional keyword fantasies."

Types and generics

Beskid types are nominal and static. The compiler is not impressed by your dynamic enlightenment phase.

  • Records, enums, contracts as declared types
  • Generics on types and methods where the grammar allows
  • ref T for reference semantics per memory model—not nullable pointers
  • No null literal, no optional keyword—see Option

Think List<T>, Map<K,V>, Option<T>—parameterized types must be explicit at boundaries; inference helpers exist but will not save you from ambiguous APIs (see type inference).

Instance calls resolve per method dispatch rules—no null receivers; use Option<T> + match.

flowchart TD
  Q[Need absence?] -->|yes| O[Option T]
  Q -->|failure| R[Result-shaped enum]
  Q -->|never| V[plain T or ref T]

Option and nullability