This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 9/16/2026.
Foreign
~import std/foreignKoru Standard Library: Foreign — host-owned identity registration
foreign.kz · 1 tors
Koru Standard Library: Foreign — host-owned identity registration · 20 more lines
Koru Standard Library: Foreign — host-owned identity registration
The airlock, not a room. `std/foreign:struct(File) { path, handle }`
registers a concept Koru does not own: the bytes live in the host (Zig,
JavaScript), Koru mints only the name. Fields are bare names — presence
claims, never types. Koru checks what it owns (does `File` have `path`);
the host checks what it owns (is `path` a valid spelling there). Deep
typing a field (`path: []const u8`) is refused loudly: that road ends in
a Koru-side Zig grammar, version drift, and the subset-parser tarpit.
What this buys is Koru-layer diagnostics for host concepts: a deref of an
unregistered field fails here, in Koru's voice, instead of leaking to the
backend compiler. What it never buys: derivation. A foreign entry grows
no container, feeds no proto field, merges with nothing — the host owns
the arrangement and Koru may not project from it.
Deliberately ugly. Every `std/foreign` line is searchable host debt; a
clean word would normalize the door. RULED 2026-09-04 (frag-type-system-design,
module rung): inspection-only, forever — any verb beyond name, list fields,
map facets reopens the ruling loudly.
~[comptime|transform] pub tor struct {
expr: Expression,
source: Source,
item: std/compiler:*const Item,
program: std/compiler:*const Program,
allocator: std.mem.Allocator,
reporter: std/compiler:*ErrorReporter
} -> SiteResult