Repository navigation
Add onSettled (handler form) and onFlush (EF-7, EF-8) - #10
Merged
Merged
Conversation
… EF-8)
onSettled(() => B) in imperative scope runs B after the change the calling
run belongs to commits; onFlush(() => B) runs B as its own instant right
after the current one, so a write can stay out of another write's hold.
Both are Solid's own functions; in reactive scope they are IO_IN_REACTIVE
(the owned onSettled is effect () { ... }), a non-closure argument is
HOOK_CALLBACK, and an onSettled cleanup return is SETTLED_CLEANUP_UNOWNED
at compile time. Scenarios S-flush-1 and S-settled-1 pass every runner.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWNyLJmSs7V2omSfCrh
compiler/src/check.rs: onSettled/onFlush checks (IO_IN_REACTIVE, HOOK_CALLBACK, SETTLED_CLEANUP_UNOWNED) as in ref/src/check.ts. compiler/src/emit.rs: lowers both to __rt.onSettled/__rt.onFlush. npm --prefix ref run crate: 286/286 agree; --lower: 166/166. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWNyLJmSs7V2omSfCrh
ryansolid
pushed a commit
that referenced
this pull request
Oct 27, 2026
Conflicts: Cargo.toml's crate-type comment (both builds use the cdylib), emit.rs's EF-7/EF-8 call and check.rs's returns_closure/hook check ported to the span-carrying AST (ExprKind/StmtKind), spec/11's decisions renumbered (main's 7 stays; the editor's are 8, 9, 10). The projection's BUILTINS and prelude take onSettled/onFlush (ref/crate.ts --project 170/170). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWP4zNW5bnup8XRB8md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Ryan · project thread
What
Before this PR, the spec covered
onSettledonly in its owned form,effect () { … }(EF-4). It had nothing for Solid'sonFlush(solidjs/solid#4292), and W-3 and AC-1 ruled it out ("to land something now, make it a guess or a separate event"). This PR adds both as functions of the language, the wayuntilis (AC-6): ordinary Solid calls with static checks and nothing extra at run time. Both are marked taken by default 2026-10-27.onSettled(() => B), called in imperative scope, runsBonce the change the calling run belongs to has committed. That is the change its writes open, or the action that adopts them (AC-1). This is Solid's unowned form.IO_IN_REACTIVE; the owned form there iseffect ().SETTLED_CLEANUP_UNOWNEDat compile time.onFlush(() => B)runsBas a separate run, and so a separate instant, right after the current one. It never waits on a hold, soB's writes commit on their own unless they join a hold (H-2, D-8).onFlushschedules another run.onFlushfor writes that should land now.HOOK_CALLBACK, new). Solid'sON_FLUSH_IN_OWNED_SCOPEwarning becomes a static error. spec/99 is updated.ref/ and the crate
runtime.ts) and the checker (check.ts) implement EF-7 and EF-8.onSettled/onFlush. On the server they throw if called, since no imperative run happens there (SV-2a).(flush)row, chained like(effect).compiler/src/check.rsandcompiler/src/emit.rs.Scenarios
onFlushwaits for the page.Runs (ref/SOLID_NEXT 0847122)
RX_CRATE=1)npm --prefix ref run cratecrate -- --lowerThe oracle runs Solid's own functions and agrees with the spec's frames on both new scenarios.
🤖 Generated with Claude Code
https://claude.ai/code/session_0117BoWNyLJmSs7V2omSfCrh