Skip to content

v0.0.19: Effect handler compilation (C6j)

Choose a tag to compare

@aallan aallan released this 25 Feb 01:52
3fbc3c2

C6j: Effect Handler Compilation

Compile handle[State<T>] expressions to WASM via host imports.

Added

  • 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
  • Handler clauses serve as specifications (not compiled) — resume() calls describe the default State semantics, validated by type checker
  • Effect discharge: pure functions containing handle[State<T>] are compilable — state imports registered by scanning function body for handle expressions
  • Unsupported handlers (Exn, custom effects) cause function to be skipped with warning
  • Reworked examples/effect_handler.vera: added test_state_init and test_put_get
  • 14 new codegen tests (691 total)

Closes #28 · PR: #49