docs: update ROADMAP and PHASE8 with completed features

Mark as done:
- for x in collection iterator loops
- Trait bounds (T: Comparable)
- CTFE (compile-time const evaluation)
- Selfhost bootstrap loop (deterministic C output)
- Implicit generic type argument inference
This commit is contained in:
2026-06-10 11:21:04 +03:00
parent c7d4c87fcf
commit 5eec4328f3
2 changed files with 55 additions and 21 deletions
+9 -5
View File
@@ -1,6 +1,6 @@
# Фаза 8 — Стратегия: Как Bux печели, без да бие пряко Rust/Nim/Zig
> **Дата:** 2026-06-09 | **Статус:** Фаза 8.1 ✅, 8.2 ✅ (basic), 8.3-8.6 🔄
> **Дата:** 2026-06-09 | **Статус:** Фаза 8.1 ✅, 8.2 ✅ (basic + CTFE), 8.3-8.6 🔄
> **Последни постижения:** defer ✅, switch/case ✅, operator overloading ✅, string interpolation ✅, named/default params ✅, basic borrow checker ✅, `bux fmt` ✅, `bux test` ✅, `bux new`/`init` ✅, selfhost-loop deterministic ✅
> **Правило #1:** Не се биеш с някого там, където той е най-силен.
@@ -81,9 +81,10 @@ func MergeSorted(a: &[int], b: &[int]) -> Vec<int> { ... }
| 8.2.1 | `@[Checked]` атрибут — вкл/изкл на checker | Да знаем кога да проверяваме | **P0 — критично** | ✅ |
| 8.2.2 | `&T` shared reference + lifetime elision | Basic borrow без annotations | **P0** | ✅ |
| 8.2.3 | `&mut T` exclusive mutable | Да няма data races | **P0** | ✅ |
| 8.2.4 | Bounds checking на slices | Да няма buffer overflows | **P1** | 🔄 |
| 8.2.4 | Bounds checking на slices (`Array_Get`/`Array_Set`) | Да няма buffer overflows | **P1** | |
| 8.2.5 | Explicit lifetimes `'a` | Само за сложни случаи | **P2** | ⏳ |
| 8.2.6 | `own T` + move semantics | RAII без GC | **P2** | ✅ (basic) |
| 8.2.7 | CTFE — compile-time const evaluation | Precomputed tables | **P1** | ✅ |
**Какво ПРОПУСКАМЕ (за да не стане Rust #2):**
- ❌ Няма да правим lifetime annotations задължителни
@@ -297,14 +298,17 @@ Crates.io е непреодолимо предимство. Ние се конк
- ✅ Closures (capture-less anonymous functions) — готово
- ✅ Closures with captures — готово
-`for i in lo..hi` / `for i in lo..=hi` range loops — готово
- 🔄 `for x in collection` (Array/Map/Channel) — чака generic monomorphization
- `for x in collection` (Array/Map/Channel) — готово
- ✅ Trait bounds (`T: Comparable`) — готово
- ✅ Implicit generic inference (`Array_Push(&arr, 10)`) — готово
- 🎯 Target: Можеш да напишеш `bux` package manager на Bux
### Milestone B: "Използваем за systems programming" (2 месеца)
- ✅ Working `@[Checked]` с basic borrow checking
- ✅ CTFE за precomputed tables
- 🔄 Trait bounds (`T: Comparable`)
- 🔄 Bounds checking на slices
- Trait bounds (`T: Comparable`)
- Bounds checking на slices (`Array_Get`/`Array_Set`)
- 🔄 Destructors / `Drop` trait
- 🎯 Target: Можеш да напишеш game engine или embedded firmware
### Milestone C: "Екосистема" (6 месеца)
+46 -16
View File
@@ -1,6 +1,6 @@
# Bux Language Roadmap — New Constructs
> **Updated:** 2026-06-08 | **Status:** In Progress
> **Updated:** 2026-06-09 | **Status:** In Progress
This document tracks planned language constructs beyond Phase 8 strategy.
@@ -123,7 +123,7 @@ let s = HttpResponse(404, body: "err"); // positional + named mixed
### 8. Full Selfhost Bootstrap Loop
**Why:** The selfhost compiler must compile itself deterministically.
**Status:** 🔄 In progress — borrow checker works, but some features still missing in selfhost vs bootstrap.
**Status:** ✅ Done — selfhost-loop produces identical C output on every iteration.
---
@@ -175,11 +175,9 @@ for msg in channel {
**Implementation Steps:**
1. ✅ Parser: extend `for` to accept `for <ident> in <expr> { ... }`
2. ✅ Range-based: `for i in lo..hi` and `for i in lo..=hi` — desugared to `while` loop with counter
3. 🔄 Collection-based: `for x in arr`needs `Iter<T>` desugaring or trait-based iterator
- Blocked by: generic monomorphization in selfhost C backend
- Once unblocked: desugar to `let __iter = Array_Iter(&arr); while Iter_HasNext(&__iter) { let x = Iter_Next(&__iter); body }`
3. Collection-based: `for x in arr`desugared to `Array_Iter_T` + `Iter_HasNext_T` + `Iter_Next_T`
**Complexity:** Medium — range-based done; collection-based needs generic monomorphization first.
**Complexity:** Medium — done.
---
@@ -206,16 +204,18 @@ extend Array<T> {
---
## P2Nice to Have
## P1High Impact
### 9. Trait System Enhancement
**Why:** Currently have `interface` + `extend` (basic). Need trait bounds, associated types.
### 9. Trait Bounds (`T: Comparable`)
**Why:** Generic functions need constraints on type parameters.
**Syntax:**
```bux
func Sort<T: Comparable>(arr: &mut Array<T>) { ... }
```
**Status:** ✅ Implemented — `@[Comparable]` attribute + `Sema_CheckTraitBounds` in selfhost.
---
### 10. CTFE (Compile-Time Function Execution)
@@ -223,13 +223,38 @@ func Sort<T: Comparable>(arr: &mut Array<T>) { ... }
**Syntax:**
```bux
const func Fib(n: int) -> int { ... }
const TABLE_SIZE = Fib(20);
const A: int = 10;
const B: int = 20;
const C: int = A + B; // Evaluated at compile time
```
**Status:** ✅ Implemented — multi-pass expression evaluator in HIR lowering.
**Supported:** literals, binary/unary/ternary ops, casts, cross-const references.
---
### 11. Concurrency
### 11. Destructors / `Drop` Trait
**Why:** `own T` exists but nothing cleans up automatically. Complements `defer`.
**Syntax:**
```bux
extend Array<T> {
func Drop(self: own Array<T>) {
Array_Free(self);
}
}
```
**Status:** ⏳ Not started.
**Complexity:** High — needs ownership tracking + C backend scope emission.
---
## P2 — Nice to Have
### 12. Concurrency
**Why:** Go-style goroutines + channels, but without GC.
**Syntax:**
@@ -249,7 +274,12 @@ Task::Spawn(Worker, rx);
5.**Named/default parameters** — Done
6.**Basic borrow checker (`@[Checked]`)** — Done (selfhost)
7.**`bux fmt`, `bux test`, `bux new`, `bux init`** — Done (selfhost)
8.**Closures (capture-less)** — Done. Enables callbacks and higher-order functions.
9.**Closures with captures** — Done. Global env struct per closure AST node.
10. **`for x in collection`** — Depends on closures with captures or trait system. **← NEXT**
11. **Destructors / Drop** — High complexity, needs ownership + move semantics.
8.**Closures (capture-less)** — Done
9.**Closures with captures** — Done
10. **`for x in collection`** — Done
11. **Trait bounds (`T: Comparable`)** — Done
12.**CTFE** — Done
13.**Selfhost bootstrap loop** — Done
14. **Destructors / Drop** — High complexity, needs ownership + C backend scope emission. **← NEXT**
15. **Bounds checking on slices** — Add `Slice<T>` type with bounds-checked indexing.
16. **Concurrency** — Green threads + channels.