comptime storage and function values

This commit is contained in:
2026-07-03 23:23:36 +02:00
parent ee41a54e41
commit 4ebe9c90e9
8 changed files with 1255 additions and 119 deletions
+16 -14
View File
@@ -676,11 +676,9 @@
- immutable locals/globals with comptime-known initializers may feed comptime
evaluation; runtime-dependent values remain invalid in comptime contexts
- runtime-only behavior is rejected in comptime: external/bodyless `c_func`,
writable globals, pointers/slices, address/deref storage APIs, pointer captures,
and function-pointer calls
- v1 keeps integer-only `$N` specialization keys; aggregate comptime parameters,
stable aggregate serialization, comptime pointers/slices, and calls through
comptime-known function values/function pointers are deferred
writable globals, and materializing comptime storage pointers/slices as runtime memory
- v1 keeps integer-only `$N` specialization keys; aggregate comptime parameters
and stable aggregate serialization are deferred
27.8 source-defined mutable runtime globals (implemented)
- allow mutable global declarations in Brolang source for process-global runtime
@@ -698,15 +696,19 @@
- reject user-visible name shadowing across imports, named types, globals, functions,
params, locals, comptime params, captures, and labels; `_` remains reusable
27.9 comptime storage and function values
- add a comptime pointer/storage model for pointers, slices, address/deref,
pointer captures, lifetimes, aliasing, mutability, and escape rules
- define what `$&value` and other comptime addresses can legally materialize into,
without exposing compiler-owned memory as runtime memory
- add first-class comptime function values and calls through comptime-known function
pointers
- resolve function-pointer targets during comptime execution, apply ABI/runtime
restrictions, and reliably reject imported/runtime callbacks
27.9 comptime storage and function values (implemented; practical v1)
- comptime locals, params, and immutable globals can own evaluator storage cells
addressable through places instead of compiler-owned memory
- comptime supports address/deref, mutable pointer and slice mutation, field/index
places, slicing, `.len`, `.ptr`, pointer captures, and pointer-param aliasing
- comptime storage pointers/slices cannot materialize as runtime memory; escaped
dead storage is rejected
- bare concrete non-comptime function names are values; native function pointer
types use `*func(...) R` and fallible `*func(...) R ! E`
- comptime-known native/bodyful `c_func` values can be called; bodyless/imported
callbacks remain runtime-only
- native function pointers are non-variadic v1; C variadic function pointers stay
under `*c_func(...) R`
28. brolang build system (requires comptime execution)