Structs, enums, methods
Structs
Section titled “Structs”Plain records. Fields are laid out in declaration order, addressed by name in source.
Methods
Section titled “Methods”The receiver goes between function and the name. Calls dispatch
by receiver type at the call site.
Tagged unions with optional positional payloads. The standard
library injects Option[T] and Result[T, E], so you don’t
re-declare them.
Match is exhaustive
Section titled “Match is exhaustive”The checker fails the build if a match misses a variant, unless
a wildcard _ arm acknowledges the gap.
function describe(s: Shape): string { match (s) { Circle(_) => { return "round"; }, // error: missing variant Rectangle // ^~~~~ }}