docs: update ROADMAP and LanguageRef with closures
- Mark capture-less closures as ✅ Done in ROADMAP
- Add closure syntax examples to LanguageRef.md Functions section
- Update PHASE8_STRATEGY.md Milestone A with closures
This commit is contained in:
@@ -184,6 +184,14 @@ func Vec2_operator_eq(self: *Vec2, other: Vec2) -> bool { ... }
|
|||||||
func Vec2_operator_lt(self: *Vec2, other: Vec2) -> bool { ... }
|
func Vec2_operator_lt(self: *Vec2, other: Vec2) -> bool { ... }
|
||||||
func MyArray_operator_index_get(self: *MyArray, idx: int) -> int { ... }
|
func MyArray_operator_index_get(self: *MyArray, idx: int) -> int { ... }
|
||||||
func MyArray_operator_index_set(self: *MyArray, idx: int, value: int) { ... }
|
func MyArray_operator_index_set(self: *MyArray, idx: int, value: int) { ... }
|
||||||
|
|
||||||
|
// Closures (capture-less for now)
|
||||||
|
let add: func(int, int) -> int = |a: int, b: int| -> int { return a + b; };
|
||||||
|
let sum: int = add(3, 4); // 7
|
||||||
|
|
||||||
|
// Closure passed to higher-order function
|
||||||
|
func Apply(x: int, op: func(int) -> int) -> int { return op(x); }
|
||||||
|
let doubled: int = Apply(5, |x: int| -> int { return x * 2; }); // 10
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -294,6 +294,7 @@ Crates.io е непреодолимо предимство. Ние се конк
|
|||||||
- ✅ defer, switch/case, operator overloading — готово
|
- ✅ defer, switch/case, operator overloading — готово
|
||||||
- ✅ `bux new`, `bux init`, `bux test`, `bux fmt` — готово
|
- ✅ `bux new`, `bux init`, `bux test`, `bux fmt` — готово
|
||||||
- ✅ Basic borrow checker (`@[Checked]`) — готово
|
- ✅ Basic borrow checker (`@[Checked]`) — готово
|
||||||
|
- ✅ Closures (capture-less anonymous functions) — готово
|
||||||
- 🎯 Target: Можеш да напишеш `bux` package manager на Bux
|
- 🎯 Target: Можеш да напишеш `bux` package manager на Bux
|
||||||
|
|
||||||
### Milestone B: "Използваем за systems programming" (2 месеца)
|
### Milestone B: "Използваем за systems programming" (2 месеца)
|
||||||
|
|||||||
+4
-3
@@ -236,6 +236,7 @@ Task::Spawn(Worker, rx);
|
|||||||
5. ✅ **Named/default parameters** — Done
|
5. ✅ **Named/default parameters** — Done
|
||||||
6. ✅ **Basic borrow checker (`@[Checked]`)** — Done (selfhost)
|
6. ✅ **Basic borrow checker (`@[Checked]`)** — Done (selfhost)
|
||||||
7. ✅ **`bux fmt`, `bux test`, `bux new`, `bux init`** — Done (selfhost)
|
7. ✅ **`bux fmt`, `bux test`, `bux new`, `bux init`** — Done (selfhost)
|
||||||
8. **Closures** — High complexity, unlocks iterators and functional style. **← NEXT**
|
8. ✅ **Closures (capture-less)** — Done. Enables callbacks and higher-order functions.
|
||||||
9. **`for x in collection`** — Depends on closures or trait system.
|
9. **Closures with captures** — Needs capture analysis + environment struct. **← NEXT**
|
||||||
10. **Destructors / Drop** — High complexity, needs ownership + move semantics.
|
10. **`for x in collection`** — Depends on closures with captures or trait system.
|
||||||
|
11. **Destructors / Drop** — High complexity, needs ownership + move semantics.
|
||||||
|
|||||||
Reference in New Issue
Block a user