docs: add demos and update documentation for new features
Documentation: - Update IMPLEMENTATION_PLAN.md with current status (222 tests) - Update feature comparison table (Schema Evolution, Behavioral Types: ✅) - Add HttpServer to built-in effects list - Update OVERVIEW.md with working behavioral types examples Demo Programs: - examples/schema_evolution.lux - Version annotations, constraints, runtime ops - examples/behavioral_types.lux - pure, deterministic, commutative, idempotent, total Sample Project: - projects/rest-api/ - Full REST API demo with: - Task CRUD endpoints - Pattern matching router - JSON serialization - Effect-tracked request handling Tests: - Add behavioral type tests (pure, deterministic, commutative, idempotent, total) - 227 tests passing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -157,11 +157,32 @@ import math.{sqrt, abs}
|
||||
import prelude.*
|
||||
```
|
||||
|
||||
### Also Working
|
||||
|
||||
```lux
|
||||
// Behavioral types with compile-time verification
|
||||
fn factorial(n: Int): Int is pure is deterministic is total =
|
||||
if n <= 1 then 1 else n * factorial(n - 1)
|
||||
|
||||
fn add(a: Int, b: Int): Int is commutative = a + b
|
||||
|
||||
fn absolute(x: Int): Int is idempotent =
|
||||
if x < 0 then 0 - x else x
|
||||
|
||||
// Schema evolution with version tracking
|
||||
fn processV2(data: Int @v2): Int = data * 2
|
||||
let value: Int @v2 = 42
|
||||
let result = processV2(value)
|
||||
|
||||
// Version constraints
|
||||
fn processModern(x: Int @v2+): Int = x // v2 or later
|
||||
fn processAny(x: Int @latest): Int = x // any version
|
||||
```
|
||||
|
||||
### Planned (Not Yet Fully Implemented)
|
||||
|
||||
- **Schema Evolution**: Parsing works (`@v1`, `from @v1`), type system integration missing
|
||||
- **Behavioral Types**: Parsing works (`is pure`, `is total`), verification beyond `pure` missing
|
||||
- **Full Compilation**: JIT works for numeric code, strings/lists/ADTs missing
|
||||
- **Auto-migration Generation**: Migration bodies stored, execution pending
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user