cli: add whole-value linear aggregates

Implement STD-5 through source, AIR, verifier and deterministic interpreter.
Constructors consume nested owners; exhaustive unpack/take, explicit swap and
own.pack preserve ownership on success and failure. Support owning Option and
Result while keeping classification helpers Copy-only. Preserve borrow identity
across whole replacement and collection; distinguish individual owned arrays
from repeated heap arrays.

Specify feature contracts, invariants, diagnostics, compatibility and measured
source/AIR budgets in RFC 0023 and normative docs. Add canonical round trips,
AIR/source acceptance and rejection fixtures, CLI integration and CI checks.

Validate build, unit/extended tests, full conformance, forced-collection schedule
stress (32 seeds per quantum), hosted smoke, CLI suites, source coverage (88/88),
formatting and reference bundle generation. Source bundle grows 3.2%; Quick
Reference grows 4.0%. No MCC improvement is claimed.

Dynamic initialized linear buffers and explicit drain remain Q-036/STD-6;
frame/region/repeated heap storage is Copy-only. RFC remains Proposed.
This commit is contained in:
dev committed 2026-10-06 21:23:52 +03:00
1 parent 7eea31518d
commit 4f084decce
109 files changed
+1814 -142

No files matched your search

+5 -3
View File
@@ -1,6 +1,6 @@
# Aji standard library
Implementation in ordinary safe `.aji`: bytes, math, UTF-8, hex, Base64 and integer formatting, with 39 monomorphic functions, 14 monomorphic result enums and Copy option/result templates with two generic helpers. They are embedded with the compiler and compiled through the normal frontend/verifier when imported. They are library modules, not standalone `main` programs.
Implementation in ordinary safe `.aji`: bytes, math, UTF-8, hex, Base64 and integer formatting, with 39 monomorphic functions, 14 monomorphic result enums and option/result templates with two Copy classification helpers. They are embedded with the compiler and compiled through the normal frontend/verifier when imported. They are library modules, not standalone `main` programs.
```aji
module example
@@ -27,10 +27,12 @@ Endian APIs read/write u16/u32/u64 in LE/BE order. Reads return `std.bytes.ReadU
`std.fmt.write_u64/i64/usize/isize` write decimal ASCII into supplied buffers with `WriteResult::ok(count)` / `short_output`. Counts include a negative sign; short output stays unchanged, suffixes stay unchanged on success and no terminator is written. The [formatting example](../examples/std/format.aji) composes `value=-42 count=7` with explicit offsets and returns 17 without grants.
The compiler uses its embedded copy, so rebuild after editing these files. An installed compiler needs neither this checkout nor a runtime std search path. Standard enum types use fully qualified names in signatures, constructors and matches. Package imports and imported struct literals use explicit manifest mappings ([example](../examples/modules/aji.toml), spec 15 §14). Explicit generics and Copy option/result templates are implemented; owning collections still require linear_aggregates.
The compiler uses its embedded copy, so rebuild after editing these files. An installed compiler needs neither this checkout nor a runtime std search path. Standard enum types use fully qualified names in signatures, constructors and matches. Package imports and imported struct literals use explicit manifest mappings ([example](../examples/modules/aji.toml), spec 15 §14). Explicit generics and whole-value owning option/result templates are implemented; growing owning collections still require the STD-6 dynamic storage contract.
[API reference](../docs/reference/std.md) · [Specification](../docs/spec/16-standard-library.md) · [Plan](../docs/plan/standard-library.md) · [Import RFC](../docs/rfcs/0016-standard-library-bootstrap.md) · [Endian RFC](../docs/rfcs/0017-standard-endian-results.md) · [Bounded operations RFC](../docs/rfcs/0018-bounded-standard-operations.md) · [Text RFC](../docs/rfcs/0019-standard-text-encodings.md)
[Formatting RFC](../docs/rfcs/0020-supplied-buffer-integer-formatting.md)
`std.option.Option<T: Copy>` and `std.result.Result<T: Copy, E: Copy>` use explicit specialization and ordinary exhaustive enum matching. `is_some::<T>`/`is_ok::<T,E>` classify variants without allocation. [Generic example](../examples/std/generics.aji) returns 42; owners/resources/borrows are excluded by the Copy constraint.
`std.option.Option<T>` and `std.result.Result<T, E>` use explicit specialization and ordinary exhaustive enum matching. `is_some::<T>`/`is_ok::<T,E>` classify variants without allocation. [Generic example](../examples/std/generics.aji) returns 42; owners/resources are supported by linear_aggregates with exhaustive `match move`; borrows remain invalid members. The classification helpers keep Copy constraints.
STD-5 supports whole-value owning structs/enums/fixed arrays and individual own<T> content. Dynamic linear heap buffers remain a separately specified STD-6 storage prerequisite; no bulk operation hides nested cleanup.
+1 -1
View File
@@ -1,6 +1,6 @@
module std.option
enum Option<T: Copy> { some(T), none }
enum Option<T> { some(T), none }
fn is_some<T: Copy>(value: Option<T>) -> bool
effects []
+1 -1
View File
@@ -1,6 +1,6 @@
module std.result
enum Result<T: Copy, E: Copy> { ok(T), err(E) }
enum Result<T, E> { ok(T), err(E) }
fn is_ok<T: Copy, E: Copy>(value: Result<T, E>) -> bool
effects []