feat: macros (multi-rep, hygiene), Drop field-move, lean multi-OS CI
ci / build (ubuntu) (push) Has been cancelled
ci / unit + fmt (push) Has been cancelled
ci / examples (push) Has been cancelled
ci / goldens + tools (push) Has been cancelled
ci / apps (push) Has been cancelled
ci / selfhost smoke (push) Has been cancelled
ci / macos smoke (push) Has been cancelled
ci / windows smoke (push) Has been cancelled
ci / CI gate (push) Has been cancelled
selfhost-loop / bootstrap determinism (push) Has been cancelled

Sessions 56–69: declarative macro! with rep/zip/literal/block and
unhygienic var $name binders; partial field-move skip Drop; @[Release]
polish; LSP type hierarchy; CI Nim cache + lean macOS + Windows smoke.
This commit is contained in:
2026-07-20 17:19:46 +03:00
parent 6f2a3b1d88
commit fe3b1e8b6a
41 changed files with 5281 additions and 141 deletions
+25 -1
View File
@@ -95,6 +95,12 @@ struct Array<T> {
| `Array_Clear<T>` | `func Array_Clear<T>(arr: *Array<T>)` | Set length to 0 (keeps capacity) |
| `Array_Reserve<T>` | `func Array_Reserve<T>(arr: *Array<T>, minCap: uint)` | Grow capacity if needed |
| `Array_Free<T>` | `func Array_Free<T>(arr: *Array<T>)` | Free memory |
| `Array_Drop<T>` | `func Array_Drop<T>(self: *Array<T>)` | Drop trait entry (same as `Array_Free`) |
**RAII:** `Array<T>` is auto-dropped at scope exit. Prefer letting the compiler call
`Array_Drop` over manual `Array_Free` when ownership is clear. If you move an
array into a struct field, the **source local is not dropped** (see LanguageRef
[Drop and RAII](LanguageRef.md#drop-and-raii) / `examples/move_field.bux`).
### Example
```bux
@@ -105,13 +111,31 @@ func Main() -> int {
Array_Push<int>(&arr, 10);
Array_Push<int>(&arr, 20);
PrintInt(Array_Get<int>(&arr, 0)); // 10
Array_Free<int>(&arr);
// Array_Drop runs at end of Main (or call Array_Free manually)
return 0;
}
```
---
## Std::Drop
Trait for automatic cleanup (RAII). Defined in `lib/Drop.bux`:
```bux
interface Drop {
func Drop(self: *Self);
}
```
Implement with `extend Type for Drop { func Drop(self: *Type) { … } }` or mark
the type `@[Drop]` and provide `Type_Drop`. Full rules (early return, field-move
skip Drop, move-on-return): **LanguageRef → Drop and RAII**.
Examples: `examples/drop_early_return.bux`, `examples/move_field.bux`.
---
## Std::Iter
Lightweight iterator over `Array<T>` (index-based, no allocation).