stdlib beginnings (heap alloc)

This commit is contained in:
2026-07-01 22:36:03 +02:00
parent 870f946b52
commit 78fb661d1a
5 changed files with 147 additions and 64 deletions
+7 -4
View File
@@ -620,10 +620,13 @@
byte slice when possible, and `[;0]u8` slices can decay to immutable `*c_char`/`?*c_char`
parameters
25. dynamic heap allocation
- see below for direction
- notes below are too big in scope for a first pass and the language is not mature enough to support it yet
- this first pass should focus on just basic heap allocation, so we have something to work with
25. dynamic heap allocation (implemented; v1)
- `std/mem/heap` is a tiny relative-importable package over libc `malloc`/`free`
- `heap.alloc(size usize) ?*mut u8` returns nullable mutable byte memory; callers use existing optional unwraps
- `heap.free(ptr ?*mut u8) void` forwards to C `free`, including `none` / null
- typed allocation, allocator parameters, arenas/pools, build-mode heap policy, and escaping-allocation diagnostics remain deferred
26. comptime polymorphism (zig inspired)
## A word on multi-unwrap