Skip to content

MO-10: use Solid libraries from .rx (spec + ref + crate) - #57

Merged
ryansolid merged 3 commits into
mainfrom
claude/project-thread-5liu5g
Nov 13, 2026
Merged

ryansolid merged 3 commits into
mainfrom
claude/project-thread-5liu5g

Conversation

@ryansolid

@ryansolid ryansolid commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Requested by Ryan · project thread

Declare a Solid library once in a .d.rx, then use it like .rx.

// media.d.rx
export pure fn createToggle(initial: boolean): [ref boolean, (v: boolean) => void]
export pure fn createDebounced(ref source: string, ms: number): ref string
[isOn, setOn] = createToggle(peek props.start)   // once (RG-6); SNAPSHOT_ARGUMENT without peek
query = createDebounced(props.q, 300)            // passed as () => props.q
action flip() { setOn(!isOn) }                   // `x = setOn(v)` is IO_IN_REACTIVE

Spec (spec/09 MO-10, decision 7)

  • MO-10a: instantiates and ref params in a JS declaration; instantiates is inferred from any ref.
  • MO-10b: ref T in a result is a reader, bound to the accessor and read without a call. Function parts are io; anything else is a value.
  • MO-10c: a package's .d.rx sits beside the file its import resolves to (exports → dist/index.jsx → dist/index.d.rx). No export condition.
  • MO-10d: any accessor can hold, so a foreign reader counts as a held read for CN-3e.
  • MO-10e: foreign setters aren't source writes. The stale read after one is taught in the guide.

Built

  • ref: parser, checker, interpreter, oracle, compiled, server and types runners. The scenario library ./prims is .rx for the interpreter and real Solid primitives for the others (ref/src/prims.ts, ref/compile/prims-solid.ts).
  • crate: parse, check, model and emit, plus package_declaration. Product builds emit an ES import and the same lowering. Checked by hand on an rxc app build with a relative module and a package.
  • scenarios/S-module-4.md: frames, plus five rejected variants (SNAPSHOT_ARGUMENT, IO_IN_REACTIVE ×2 including one through a package, INSTANTIATION_NOT_BOUND, CN-3e).
  • guide/libraries.md, linked from language.md. CHANGELOG entry.

Tests

  • ref: interpreter 127/127; oracle, compiled and RX_CRATE=1 compiled each 127 pass with the 14 recorded divergences; SSR 120 pass, 0 fail, 7 skipped; types 173.
  • Crate parity: 358/358 programs, and --lower 208/208.
  • --project agrees on every program, but its prelude check fails. It fails the same way on main.
  • compiler npm test, runtime npm test and cargo test pass.
  • Not run: compiler/test/vite.mjs. The installed Solid plugin has no built-in .rx, and building the plugin checkout wasn't allowed here.

Open, taken by default

  • Readers count as held for CN-3e but not as absent for R-8. Otherwise every primitive read inside an action would raise UNGUARDED_SNAPSHOT.

🤖 Generated with Claude Code

https://claude.ai/code/session_0117BoWLEtMWwBHFA2w1P6FF

instantiates and ref in JS declarations (ref T in returns), any accessor
can hold, packages ship declarations under the rx export condition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWLEtMWwBHFA2w1P6FF
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
0b30229 2026-11-13T06:00:01.337Z View logs ↗
  • Build: Failed ❌

View logs ↗
4893600 2026-11-13T05:32:22.694Z View logs ↗
  • Build: Failed ❌

View logs ↗
e80f850 2026-11-13T05:20:23.709Z View logs ↗

…x condition

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWLEtMWwBHFA2w1P6FF
A JS declaration takes ref parameters, ref parts in its result and
instantiates (inferred from any ref). A primitive is bound as an
instantiating fn, so E-9, E-10 and RG-6 apply; ref arguments go in as
accessors, ref parts bind to the accessor, function parts are io, and a
foreign reader may hold (CN-3e). A package's .d.rx is found beside the
file its import resolves to. Built in ref/ (all five runners) and the
crate; S-module-4; guide/libraries.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWLEtMWwBHFA2w1P6FF
@ryansolid ryansolid changed the title spec/09: MO-10, declaring Solid libraries MO-10: use Solid libraries from .rx (spec + ref + crate) Nov 13, 2026
@ryansolid ryansolid self-assigned this Nov 13, 2026
@ryansolid
ryansolid merged commit ea67d8c into main Nov 13, 2026
17 of 18 checks passed
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.

2 participants