You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
7
7
## [Unreleased]
8
8
9
+
## [0.0.19] - 2026-02-25
10
+
11
+
### Added
12
+
-**Effect handler compilation** (C6j — closes [#28](https://github.com/aallan/vera/issues/28)): compile `handle[State<T>]` expressions to WASM via host imports
13
+
- State handler translation: `handle[State<T>](@T = init) { get/put clauses } in { body }` compiles by initializing state via `state_put_T`, then compiling body with get/put mapped to host imports
14
+
- Handler clauses serve as specifications (not compiled) — `resume()` calls describe the default State semantics, validated by type checker
15
+
- Effect discharge: pure functions containing `handle[State<T>]` are compilable — state imports registered by scanning function body for handle expressions
16
+
- Unsupported handlers (`Exn<E>`, custom effects) cause function to be skipped with warning
-**Codegen tests**: 14 new tests — state initialization, put/get, increment pattern, run_counter, let bindings, Bool state, WAT inspection, unsupported handler skip, example file round-trips (691 total, up from 677)
19
+
9
20
## [0.0.18] - 2026-02-25
10
21
11
22
### Added
@@ -314,7 +325,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
314
325
- Grammar: handler body simplified to avoid LALR reduce/reduce conflict
315
326
-`pyproject.toml`: corrected build backend, package discovery, PEP 639 compliance
`apply_fn` is a compiler built-in, not a user-defined function. The checker issues a warning about it being unresolved, but the code generator recognizes it and emits the appropriate `call_indirect` sequence.
392
392
393
-
## 11.11 Limitations
393
+
## 11.11 Effect Handler Compilation
394
+
395
+
The `handle[Effect<T>]` expression compiles effect handlers to WASM. Currently, `State<T>` handlers are supported via the existing host import mechanism (Section 11.7.2).
396
+
397
+
### 11.11.1 State Handler Compilation
398
+
399
+
A `handle[State<T>](@T = init) { clauses } in { body }` expression compiles to:
Handler clauses (e.g. `get(@Unit) -> { resume(@Int.0) }`) describe the handler's operational semantics but are not compiled to WASM. The host runtime already implements the correct `get`/`put` behavior. The `resume` calls in handler clauses serve as specifications validated by the type checker.
419
+
420
+
### 11.11.3 Effect Discharge
421
+
422
+
A `handle[State<T>]` expression discharges the `State<T>` effect. This means a function can be declared `effects(pure)` and still use `get`/`put` operations within a handler body. The compiler registers the State<T> host imports by scanning the function body for handle expressions, not just the function's declared effects.
423
+
424
+
### 11.11.4 Unsupported Handlers
425
+
426
+
Handler types other than `State<T>` (e.g. `Exn<E>`, custom effects) are not yet compilable. Functions containing unsupported handler types are skipped with a warning.
427
+
428
+
## 11.12 Limitations
394
429
395
430
The current compilation model has the following limitations, each tracked as a GitHub issue:
396
431
397
432
| Limitation | Issue | Notes |
398
433
|-----------|-------|-------|
399
-
| No effect handler codegen |[#28](https://github.com/aallan/vera/issues/28)| Needs continuation-passing transform |
400
434
| No Byte type codegen |[#30](https://github.com/aallan/vera/issues/30)| Needs linear memory byte operations |
401
435
| No module-level code generation | — | Each file compiles independently |
402
436
| No garbage collection | — | Bump allocator only; linear memory is not reclaimed |
403
437
| String constants only | — | No dynamic string construction |
438
+
| Only State\<T\> handlers | — | Exn\<E\> and custom effect handlers not yet compilable |
0 commit comments