code wiki / (root) / nx_stdlib.nx

nx_stdlib.nx

buildroot/runtime/nx_stdlib.nx

1137 B34 linesdepth 0pulls 0 transitivereach 3 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

stdlib.nx -- NishiLang's built-in prelude. Any file that `import "nx_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

nx_stdlib.nx fs_result_test.nx fs_unlink_tail_test.nx nx_net.nx

imports: none

imported by: fs_result_test.nxfs_unlink_tail_test.nxnx_net.nx

structs

none

consts

none

functions

none