reflection foundation, tuples, debug.print

This commit is contained in:
2026-07-14 23:45:30 +02:00
parent 267947e79d
commit 0b2055d64b
24 changed files with 126598 additions and 115394 deletions
+23 -10
View File
@@ -777,17 +777,17 @@
- keep functions package-scoped and keep the explicit form valid; this preserves simple name
resolution and gives ambiguous calls an escape hatch
31.5. inferred leading comptime parameters (implemented)
- a native call may omit its complete leading `$T type` / integer comptime prefix when every
31.5. inferred comptime parameters (implemented)
- comptime parameters may appear anywhere and are erased while preserving runtime parameter order
- a native call may omit `$T type`, integer, or immutable byte-string comptime arguments when every
value is uniquely recoverable from runtime argument types and/or the immediate expected result
- inference structurally matches direct type parameters, pointers/slices/arrays/optionals/
fallibles/functions, direct array counts, and canonical generated type-factory provenance;
forwarding/non-invertible factories keep the explicit spelling
- concrete evidence is exact; contextual numeric constants are weak evidence and are rebuilt with
the resolved parameter type before ordinary coercion
- calls are all-explicit or all-inferred (no partial prefix omission); unconstrained/conflicting
values diagnose with the explicit call as the escape hatch
- comptime parameters must form one leading prefix before every runtime parameter
- `_` explicitly leaves one comptime argument to inference; exactly one complete argument mapping
must succeed, with missing and ambiguous mappings diagnosed
- the existing specialization/HIR/LLVM ABI is unchanged; `std/mem` and `std/arraylist` now use the
inferred form where their arguments or result provide enough information
@@ -809,8 +809,8 @@
- migrated `std/mem`, `std/arraylist`, and the compound-assignment example to `divtrunc!`
33. explicit I/O provider (implemented)
- `main` may take one canonical `@std/io Io`; parameterless entry points remain valid
- the compiler supplies a `hide system` macOS provider through an external no-argument C wrapper
- `main` may take one canonical `@std/process Init`; parameterless entry points remain valid
- the compiler supplies a `hide system` macOS provider and constructs `Init` in the external C wrapper
- readers and writers pair an explicit provider with `stdin`, `stdout`, or `stderr`
- `read` and `write` validate provider counts; `write_all` handles partial writes and no progress
- the system provider uses unbuffered libc `read`/`write`, retries interruption, and allocates nothing
@@ -847,9 +847,22 @@
- `hide` is reserved for named top-level declarations and is rejected on imports, locals,
parameters, fields, and anonymous declarations
37. add a debug package in `std` that provides debugging utilities
- add `debug.print` function making use of `std/io` to print values to the console
- this may either require native variadic arguments or a tuple value to like zig's approach (consider pros and cons)
37. tuples, reflection, process init, and printing (implemented)
- tuples are unnamed-field structs with structural anonymous values, nominal named declarations,
brace literals, numeric fields, and no runtime metadata
- `@std/meta`, `typeinfo!`, `field!`, `compile_error!`, specialization-time branches, and semantic
`inline for` use checker-owned persistent compile-time values for aggregate-first reflection and
heterogeneous static expansion; inline-loop control is recursively resolved at comptime
- interleaved comptime parameters use semantic candidate resolution, immutable byte values specialize
by contents, and all comptime parameters remain erased from the runtime ABI
- `io.print(writer, format, args)` validates and expands `{s}` / `{d}` formatting at comptime,
is implemented in ordinary `@std/io` code, performs no allocation or runtime parsing, and
propagates the first write error
- `debug.print` reuses formatting through an independent stderr backend, ignores failures, and adds
no newline
- entrypoint validation accepts only parameterless `main` or canonical `main(process.Init)`, validates
the hidden `@std/io.system` provider, and injects the provider through the generated C entrypoint;
native variadics and additional startup data remain deferred
38. place every intrinsic behind direct unqualified `name!(...)` syntax, freeing the bare names for
user functions (implemented)