Files
sx/library/modules/std.sx
agra 49a36bb492 std: the prelude becomes a pure re-export facade — implementations move to std/core.sx, std/fmt.sx, std/list.sx
std.sx now contains only alias declarations (the re-export mechanism:
own decls carry one flat-import level) over three part-files: core.sx
(builtins, libc escape hatch, Source_Location/Allocator/Context/Into,
the reserved `string` decl — which needs and permits no alias), fmt.sx
(print/format/any_to_string/string ops/cstring/alloc_slice), list.sx
(List). The namespace tail is unchanged; the part-file namespaces
(core/fmt/list) carry alongside it. Consumer surface is byte-identical
— every bare prelude name resolves through the aliases (0120/0121
machinery). 37 .ir snapshots re-pinned: pure string-constant
renumbering from the changed import graph (digit-normalized diff is
empty). Gates: zig build test 426/426, suite 588/588, m3te 23/23,
game SxChess builds + bundles.
2026-06-11 19:25:49 +03:00

86 lines
2.9 KiB
Plaintext

// The prelude facade: every name here is a RE-EXPORT. The implementations
// live in the part-files (std/core.sx — compiler-coupled primitives,
// std/fmt.sx — formatting + string helpers, std/list.sx — List); each
// alias below is an ordinary OWN declaration of this file, so a flat
// `#import "modules/std.sx"` sees the whole prelude bare, one hop —
// visibility never chains, aliases are the re-export mechanism. The
// part-file namespaces (`core` / `fmt` / `list`) and the namespace tail at
// the bottom are carried to flat importers the same one level.
core :: #import "modules/std/core.sx";
fmt :: #import "modules/std/fmt.sx";
list :: #import "modules/std/list.sx";
#import "modules/std/mem.sx";
// --- core: builtins, libc escape hatch, compiler-resolved types ---
// (`string` has no alias here: it is a reserved type name — its #builtin
// declaration in core.sx resolves program-wide and cannot be re-bound.)
Vector :: core.Vector;
out :: core.out;
size_of :: core.size_of;
align_of :: core.align_of;
libc_malloc :: core.libc_malloc;
libc_free :: core.libc_free;
memcpy :: core.memcpy;
memset :: core.memset;
type_of :: core.type_of;
type_name :: core.type_name;
field_count :: core.field_count;
field_name :: core.field_name;
field_value :: core.field_value;
is_flags :: core.is_flags;
type_is_unsigned :: core.type_is_unsigned;
field_value_int :: core.field_value_int;
field_index :: core.field_index;
error_tag_name :: core.error_tag_name;
Source_Location :: core.Source_Location;
Allocator :: core.Allocator;
Context :: core.Context;
Into :: core.Into;
// --- fmt: formatting, string helpers, slice/string allocation ---
cstring :: fmt.cstring;
alloc_slice :: fmt.alloc_slice;
int_to_string :: fmt.int_to_string;
uint_to_string :: fmt.uint_to_string;
bool_to_string :: fmt.bool_to_string;
float_to_string :: fmt.float_to_string;
hex_group :: fmt.hex_group;
decompose_u16x4 :: fmt.decompose_u16x4;
int_to_hex_string :: fmt.int_to_hex_string;
concat :: fmt.concat;
substr :: fmt.substr;
path_join :: fmt.path_join;
struct_to_string :: fmt.struct_to_string;
vector_to_string :: fmt.vector_to_string;
array_to_string :: fmt.array_to_string;
slice_to_string :: fmt.slice_to_string;
pointer_to_string :: fmt.pointer_to_string;
flags_to_string :: fmt.flags_to_string;
enum_to_string :: fmt.enum_to_string;
optional_to_string :: fmt.optional_to_string;
any_to_string :: fmt.any_to_string;
build_format :: fmt.build_format;
format :: fmt.format;
print :: fmt.print;
// --- list ---
List :: list.List;
// --- The stdlib namespace tail: flat-importing std.sx carries these ---
mem :: #import "modules/std/mem.sx";
xml :: #import "modules/std/xml.sx";
log :: #import "modules/std/log.sx";
fs :: #import "modules/std/fs.sx";
process :: #import "modules/std/process.sx";
socket :: #import "modules/std/socket.sx";
json :: #import "modules/std/json.sx";
cli :: #import "modules/std/cli.sx";
hash :: #import "modules/std/hash.sx";
test :: #import "modules/std/test.sx";