Skip to content

Translate capabilities as transparent - #1474

Merged
b-studios merged 3 commits into
mainfrom
fix-tracked-capabilities
Sep 27, 2026
Merged

b-studios merged 3 commits into
mainfrom
fix-tracked-capabilities

Conversation

@b-studios

Copy link
Copy Markdown
Collaborator

Summary

Fix capture sets for handled capabilities during Core transformation.

A handler such as:

try {
  do tick()
} with tick {
  resume(())
  println("tick")
}

is translated to a transparent def:

reset { p =>
  def tick = new tick {
    ...
    println("tick")
  }

  do tick()
}

The source program types the handled body as capturing {tickCap}. After translation, tick is bound to a concrete handler that captures the prompt and io, so uses of tick must instead capture:

{p, io}

Previously, core retained the stale {tickCap} annotation.

The transformer now records a latent substitution when introducing a tracked Def binding:

tickCap ↦ {p, io}

This substitution is applied while translating subsequent capture sets and follows the existing withBindings scope.

@b-studios
b-studios merged commit b630e94 into main Sep 27, 2026
10 of 11 checks passed
@b-studios
b-studios deleted the fix-tracked-capabilities branch September 27, 2026 12:14
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