code wiki / (root) / stdlib.nx

stdlib.nx

buildroot/runtime/stdlib.nx

1134 B34 linesdepth 0pulls 0 transitivereach 5 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

stdlib.nx -- NishiLang's built-in prelude. Any file that `import "stdlib.nx"` gets Option<T> + Result<T, E> as real generic tagged enums, backed by the shadow-struct lowering in parse.c/parse.nx. Stage 2 constructor / use: let some_v: *Option<i64> = Option::Some(42) let none_v: *Option<i64> = Option::None match some_v { Option::Some(x) => { ... x ... }, Option::None => { ... }, } The shadow struct is `{ tag: i64, payload: i64 }` for every instantiation -- T is erased into an 8-byte payload slot at this stage, so any T that fits in 8 bytes (primitives, pointers, small enums) rides the shared layout. Types stay distinct at the IR surface (Option$i64 vs Result$i64$i64 etc.) so imports do not collide. Stage 3 introduces variant-sized unions for payloads wider than 8 bytes. Keep this file declarations-only -- no functions, no main -- so callers can import it alongside other libraries cleanly.

dependencies 0 imports · 3 importers

stdlib.nx fs.nx net.nx stdlib_test.nx

imports: none

imported by: fs.nxnet.nxstdlib_test.nx

structs

none

consts

none

functions

none