This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 10/5/2026.
Types.enum
~import std/types.enumKoru Standard Library: the `enum` part of types — closed tag-set mints.
types.enum.kz · 1 tors
Koru Standard Library: the `enum` part of types — closed tag-set mints. · 17 more lines
Koru Standard Library: the `enum` part of types — closed tag-set mints.
Joined via `~part enum` in types.kz; merged into the types module.
`std/types:enum(ThreatLevel) { low, medium, high }` mints a NOMINAL closed
tag set — the first materialization rung under the post-dissolution
registry: the entry IS its tag list, so nothing is projected from a proto
(there are no fields to inherit); the mint stands alone. What it emits is
a host enum the tag names survive into — `{{ level:t }}` prints `high`,
the C# `$"{s.ThreatLevel}"` parity the LINQ-shaped examples need (`:s`
refuses at the Zig layer — a slice spec on an enum — so tag-name printing
spells `:t`; a Koru-layer diagnostic for `:s`-on-enum is a later rung) —
plus a `// proto-terminal` marker so field-type resolution
(`level: ThreatLevel` in a compound) answers like any other terminal: the
terminal's host material is its own name, and consumers re-emitting it
land on the minted const. Rung 1 is bare tags only — implicit ordinals,
`i64` backing; explicit values and width args are later rungs and refuse
loudly here rather than half-parse.
// Koru Standard Library: the `enum` part of types — closed tag-set mints.
// Joined via `~part enum` in types.kz; merged into the types module.
//
// `std/types:enum(ThreatLevel) { low, medium, high }` mints a NOMINAL closed
// tag set — the first materialization rung under the post-dissolution
// registry: the entry IS its tag list, so nothing is projected from a proto
// (there are no fields to inherit); the mint stands alone. What it emits is
// a host enum the tag names survive into — `{{ level:t }}` prints `high`,
// the C# `$"{s.ThreatLevel}"` parity the LINQ-shaped examples need (`:s`
// refuses at the Zig layer — a slice spec on an enum — so tag-name printing
// spells `:t`; a Koru-layer diagnostic for `:s`-on-enum is a later rung) —
// plus a `// proto-terminal` marker so field-type resolution
// (`level: ThreatLevel` in a compound) answers like any other terminal: the
// terminal's host material is its own name, and consumers re-emitting it
// land on the minted const. Rung 1 is bare tags only — implicit ordinals,
// `i64` backing; explicit values and width args are later rungs and refuse
// loudly here rather than half-parse.
~[comptime|transform] pub tor enum {
expr: Expression,
source: Source,
item: std/compiler:*const Item,
program: std/compiler:*const Program,
allocator: std.mem.Allocator,
reporter: std/compiler:*ErrorReporter
} -> SiteResult