Skip to content

feat: enforce tail-resumptive handlers in capability methods (#564) - #1380

Closed
godofecht wants to merge 1 commit into
mainfrom
issue-564-8072556545414131140
Closed

godofecht wants to merge 1 commit into
mainfrom
issue-564-8072556545414131140

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Closes #564

Re-implements the feature requested cleanly from main to address massive regressions introduced in the previous cursor-effects-tail-resumptive-2586 branch. The current implementation uses AST scanning inside typecheck.flow to fail compilation when resume or resume_multi is found within a capability method (AST_CAP_METHOD).

Changes

  • Updated compiler/src/typecheck.flow to enforce tail-resumption.
  • Regenerated the Stage-A C compiler bootstrap in compiler/bootstrap/flowc_stage_a.c.
  • Extensive documentation added to formalize the limitation (incl. docs/language/effects-continuations.md).
  • Both positive path (tests/lang/test_effects_tail_resumptive.flow) and negative path tests (tests/lang/test_effects_continuations_error.flow, tests/lang/test_effects_continuations_multi_error.flow) verified and passing.

No features from subsequent pull requests were inadvertently reverted.


PR created automatically by Jules for task 8072556545414131140 started by @godofecht

Handlers in Flow are strictly tail-resumptive. This commit formally restricts usage of Koka/Eff style continuations by introducing compiler checks in `typecheck.flow` that recursively scan capability method bodies for the `resume` and `resume_multi` identifiers.

If encountered, the compiler now correctly fails with a specific diagnostic outlining the limitation and linking to the official documentation. The PR also includes comprehensive documentation updates (e.g. `docs/language/effects-continuations.md`) describing the decision and alternate coding patterns to achieve timeout, loop retry, and continuation via manual polling.

Co-authored-by: godofecht <[email protected]>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@godofecht

Copy link
Copy Markdown
Contributor Author

Superseded by #1349 (merged as cbe3e62). The typecheck rejection of resume / resume_multi in capability methods, docs/language/effects-continuations.md, the RFC and showcase edits and tests/lang/test_effects_tail_resumptive.flow are all on main. The only missing line is the spec-index.md row for effects-continuations.md, listed for the docs salvage PR in the merge queue. Closing during PR triage; the branch is kept.

@godofecht godofecht closed this Oct 7, 2026
@google-labs-jules

Copy link
Copy Markdown
Contributor

Superseded by #1349 (merged as cbe3e62). The typecheck rejection of resume / resume_multi in capability methods, docs/language/effects-continuations.md, the RFC and showcase edits and tests/lang/test_effects_tail_resumptive.flow are all on main. The only missing line is the spec-index.md row for effects-continuations.md, listed for the docs salvage PR in the merge queue. Closing during PR triage; the branch is kept.

Understood. Acknowledging that this work is now obsolete and stopping work on this task.

godofecht added a commit that referenced this pull request Oct 7, 2026
…om closed PRs

Salvaged from closed pull requests whose code already landed:

- #1360 (region inference, code merged as #1390): region-inference.md,
  the tests/cgen region_inference and region_unproven goldens, and the
  spec, book, spans, lifetime-domains, README, spec-index, nav and
  CHANGELOG lines.
- #1368 (noalias, code merged as #1388): the spans.md paragraph on
  restrict .data temporaries and its noalias.md link.
- #1380 (tail-resumptive effects, code merged as #1349): the spec-index
  row for effects-continuations.md.

#1417 landed after #1360 and keeps an unproven forward copy as an
ordered element loop. The region_inference golden and the docs now say
that, in place of the memmove the closed branch expected. The golden
fails on the pre-#1417 compiler, which emitted memmove.
godofecht added a commit that referenced this pull request Oct 7, 2026
…om closed PRs (#1425)

Salvaged from closed #1360 (region-inference.md, region_inference and region_unproven goldens, spec/book/index lines), #1368 (spans.md restrict .data paragraph) and #1380 (spec-index row for effects-continuations.md). The region_inference golden and docs follow #1417: an unproven parameter copy stays an ordered loop.
@godofecht
godofecht deleted the issue-564-8072556545414131140 branch October 12, 2026 23:03
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.

Algebraic effects are tail-resumptive only: no abort, retry, or multi-shot continuations

1 participant