This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 9/16/2026.
Proto
~import std/protoKoru Standard Library: Proto — compound identity declarations
proto.kz · 13 tors
Koru Standard Library: Proto — compound identity declarations · 25 more lines
Koru Standard Library: Proto — compound identity declarations
The compound front door for proto entries. `std/proto(Name) { fields }`
invokes this module's `default` event through the default-event rule
(`std/M(args)` ≡ `std/M:default(args)`; see import_pipeline.zig
rewriteDefaultEventCalls). The module name IS the verb — `default` is
reachable only through the path, never bare.
SURFACE:
std/proto(Player) { health: Health, hp: f32 }
declares a COMPILE-TIME registry entry — layout-silent, with no
emission of its own. The first consumer derives what it needs
(std/list:new synthesizes the element struct plus its `List_<Name>`
container from these fields). The terminal half of the system — named
primitives (`std/proto:f64(Health)`) — is the same act at field
count zero and lands here as the system grows.
RULED 2026-08-23 → 09-03 (frag-type-system-design, proto rung; co-derived
on the 09-03 walk): a proto names an AFFINITY, never a coupling — the
entry is the identity, "same thing" is by NAME ONLY, and the layout system
may merge only what a shared name proves identical (never two anonymous
fields that merely look alike). Two registrants of the same name are a
loud collision; values over two different protos must not interchange
(both refused at the KORU layer by the nominal-distinctness gate;
see scanDeclaredTypes + the container registration it derives).
~[comptime|transform] pub tor default {
expr: Expression,
source: Source,
item: std/compiler:*const Item,
program: std/compiler:*const Program,
allocator: std.mem.Allocator,
reporter: std/compiler:*ErrorReporter
} -> SiteResult~[comptime|transform] pub tor i8 {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor i16 {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor i32 {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor i64 {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor u8 {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor u16 {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor u32 {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor u64 {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor f32 {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor f64 {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor bool {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult~[comptime|transform] pub tor string {
expr: Expression,
item: std/compiler:*const Item,
allocator: std.mem.Allocator
} -> SiteResult