Skip to content

effects: handler rows, deep handlers (E1b) - #37

Merged
vic merged 1 commit into
mainfrom
e1b-handler-rows
Nov 9, 2026
Merged

vic merged 1 commit into
mainfrom
e1b-handler-rows

Conversation

@vic

@vic vic commented Nov 9, 2026

Copy link
Copy Markdown
Owner

E1b (bead vic-yjou.9): handler ops may request effects.

handler Tag for Out:
  def put(n: I64): Unit = Out.put(n * 10)   // the Out handler outside Tag answers
  • A handler is one subject of the effect rows (s2/eff.srs): its row is what all its fns request. handle x = H() counts as a call of H in the scope outside the handle. So the handlers outside the handle answer the ops' requests (deep handlers, kyo semantics).
  • Each fn of the handler takes the handler's row as implicit capabilities. El.Handle carries the capabilities captured at the handle site.
  • Emit: for a handler with a row, the handle site builds an env { st, c[] } and the capability's self points to it. The vtable points to wrappers w_H_op(env, args) that call h_H_op(c..., st, args). Handlers with no row emit as before.
  • Purity: a handler row counts as huses.

Tests: prog/eff_handler_row and neg/eff_handler_row. Local gate: 200 ok, 0 FAIL (seed updated: the emitter adds the srs_env typedef).

Mutants:

  • Drop the call of the handler at handle: killed after I added viaStd (unhandled-effect).
  • Capture from inside the handle: killed, but by a C error (the handle's own name is not yet declared), not by the output.
  • Wrapper drops a capability: killed (C arity).

…ows: what its ops request comes from the handlers outside its handle (deep handlers), captured when the handle runs. The handle site keeps the capabilities in an env next to the state; the vtable points to wrappers that pass them
@vic
vic merged commit 01f87f6 into main Nov 9, 2026
3 checks passed
@vic
vic deleted the e1b-handler-rows branch November 17, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant