[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-111598":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":9,"pushedAt":25,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":15,"starSnapshotCount":15,"syncStatus":13,"lastSyncTime":29,"discoverSource":30},111598,"reactivescript","solidjs\u002Freactivescript","solidjs","Reactivity as a Language",null,"TypeScript",135,7,2,14,0,1,15,76,5,59.81,"MIT License",false,"main",[],"2026-11-23 14:03:12","2026-11-23 17:48:10","\u003Cimg src=\"assets\u002Flogo.svg\" width=\"96\" height=\"96\" alt=\"\">\n\n# ReactiveScript\n\nA small language for reactive UIs that carries\n[Solid](https:\u002F\u002Fgithub.com\u002Fsolidjs\u002Fsolid) 2.0's reactive semantics as\n*language* semantics, and checks them before your code runs. Files are `.rx`;\nthey compile to plain Solid 2.0.\n\n> **Status:** experimental, 0.1. The spec, its scenarios and the compiler\n> still change often, and releases follow Solid 2.0's release candidates. See\n> [CONTRIBUTING.md](CONTRIBUTING.md) to run the suite or propose a change.\n\n## Why\n\nIn Solid you already write UIs as derivations over signals. Most of what goes\nwrong is a *shape* mistake: writing to something that should be derived,\nwriting during a computation, reading async data with no loading or error\nboundary above it, leaking a value past the owner that created it. Solid's\ndev runtime warns about many of these when they happen. ReactiveScript makes\nthem things the compiler refuses, the way Rust refuses a borrow, so the\nprogram that runs is one where those mistakes cannot happen\n([spec\u002F08](spec\u002F08-constraints.md), [spec\u002F99](spec\u002F99-diagnostics.md)).\n\nThe checks are static only. A `.rx` program compiles to ordinary Solid 2.0\ncode and adds nothing at run time beyond what Solid does\n([spec\u002F11](spec\u002F11-compiler.md)).\n\nIt is also meant to be easy for an AI to write correctly. The rules are\nsmall and explicit, and each checker error names the rule it enforces and usually the fix. We\ntest that directly: fresh agents given only the spec wrote the apps in\n[`examples\u002Fai`](examples\u002Fai) and [`examples\u002Fai2`](examples\u002Fai2) cold and\npredicted 70 of 71 frames of their behaviour before running them\n([examples\u002FREADME.md](examples\u002FREADME.md)).\n\n## A taste\n\nThree kinds of names do all the work:\n\n- `source x := 0` is state. Only a source can be written, with `:=`.\n- `y = x * 2` is an **equation**: it is always true, and recomputes when\n  what it reads changes (E-1).\n- Writes happen only in imperative scope: an event handler or an `action`\n  (W-1, W-2).\n\n```rx\nexport default component Counter() {\n  source count := 0\n  double = count * 2\n\n  \u003Cbutton onClick={() => { count := count + 1 }}>{count} × 2 = {double}\u003C\u002Fbutton>\n}\n```\n\nWrite to the equation instead, `double := 4`, and the checker refuses it:\n\n```\ncounter.rx:5: error WRITE_TO_NON_SOURCE [W-1] double is an equation: only sources are written\n```\n\nAsync is an `await` in an equation. The compiler tracks that the value can be\npending and can fail, so it asks you to say what to show in both cases:\n\n```rx\nimport pure { fetchUser } from \".\u002Fapi\"   \u002F\u002F `pure`: safe to call from an equation (R-io-4)\n\nexport default component Profile() {\n  source id := 1\n  user = await fetchUser(id)              \u002F\u002F re-asked whenever `id` changes\n\n  \u003Csection>\n    \u003Cbutton onClick={() => { id := id + 1 }}>Next\u003C\u002Fbutton>\n    {errored fallback(e) { \u003Cp>Couldn't load: {e.message}\u003C\u002Fp> } {\n      {loading fallback { \u003Cp>Loading…\u003C\u002Fp> } {\n        \u003Ch1>{user.name}\u003C\u002Fh1>\n      }}\n    }}\n  \u003C\u002Fsection>\n}\n```\n\nLeave out the `errored` boundary and it does not compile:\n\n```\nprofile.rx:10: error UNHANDLED_FAILURE [R-f-5] a reader of user.name (in \u003CProfile>) can fail with Error and no catch or errored boundary above it discharges Error — wrap it in `errored fallback(e) { … } { … }`, or catch it: `… catch (e) => …`\n```\n\nBeyond this the language has structured stores with per-path writes\n([spec\u002F06](spec\u002F06-stores.md)), optimistic updates and held values while new\ndata loads ([spec\u002F05](spec\u002F05-holds.md)), modules that own their state and\nexport actions to change it ([spec\u002F09](spec\u002F09-modules.md)), streamed SSR with\nhydration ([spec\u002F10](spec\u002F10-server.md)), `server fn` for code that runs on\nthe server ([spec\u002F12](spec\u002F12-server-functions.md)), scoped `\u003Cstyle>`\n([spec\u002F07](spec\u002F07-surface.md)), and types checked by TypeScript through a\nTSX projection ([spec\u002F13](spec\u002F13-types.md)). For whole apps, start with\n[`examples\u002Ftodo.rx`](examples\u002Ftodo.rx) and\n[`examples\u002Fsignup.rx`](examples\u002Fsignup.rx).\n\n## What's here\n\n| | |\n| --- | --- |\n| [`spec\u002F`](spec) | the language, as numbered rules |\n| [`scenarios\u002F`](scenarios) | about 100 executable cases: program, actions, expected frames, accepted or refused |\n| [`examples\u002F`](examples) | real apps in `.rx` |\n| [`ref\u002F`](ref) | the reference implementation in TypeScript: interpreter, checker, compiler, and runners that check every scenario against Solid itself |\n| [`compiler\u002F`](compiler) | the production compiler, a Rust crate (`rxc`) built on Solid's own compiler; also the npm package `@reactivescript\u002Fcompiler` with a Vite front end |\n| [`runtime\u002F`](runtime) | `@reactivescript\u002Fruntime`, the small layer compiled `.rx` calls over Solid |\n| [`tooling\u002Frx-language-server`](tooling\u002Frx-language-server) | the `.rx` language server: TypeScript's hover, go to definition, rename, completion and type errors on `.rx`, plus the checker's diagnostics with their rules |\n| [`tooling\u002Fvscode-rx`](tooling\u002Fvscode-rx) | the VS Code extension: highlighting, and the language server |\n\n## Install\n\nReactiveScript 0.1 is experimental. It follows Solid 2.0's release\ncandidates, so expect breaking changes until Solid 2.0 is final.\n\n**In a Solid app (Vite).** Install the compiler and the runtime beside Solid\n2.0:\n\n```sh\nnpm i solid-js@next @solidjs\u002Fweb@next @solidjs\u002Fsignals@next @reactivescript\u002Fruntime\nnpm i -D vite @solidjs\u002Fvite-plugin @reactivescript\u002Fcompiler\n```\n\nKeep `solid()` in `vite.config.js` as it is. Solid's Vite plugin\n(3.0.0-next.57 or later) finds the compiler and compiles `.rx` on its own\n(spec\u002F11 CP-7).\n\n```rx\n\u002F\u002F src\u002Fapp.rx\nexport default component App() {\n  source count := 0\n  doubled = count * 2\n  \u003Cbutton onClick={() => { count := count + 1 }}>{count} × 2 = {doubled}\u003C\u002Fbutton>\n}\n```\n\n```js\n\u002F\u002F src\u002Fmain.js\nimport { createApp } from \"@reactivescript\u002Fruntime\";\nimport main from \".\u002Fapp.rx\";\n\nconst app = createApp({ root: document.getElementById(\"app\") });\napp.mount(main(app));\n```\n\n**In an editor.** Install the ReactiveScript extension (publisher\n`solidjs`) from the VS Code Marketplace, or from Open VSX for Cursor\nand VSCodium. It brings highlighting and the language server. Other editors\ncan run the language server on its own: `npx @reactivescript\u002Flanguage-server\n--stdio` ([`tooling\u002Frx-language-server`](tooling\u002Frx-language-server)).\n\n**In CI.** Vite compiles `.rx` without type-checking it, as it does `.ts`.\n`rx-tsc` is `tsc` with `.rx` in the program: the same check the editor runs,\nplus the checker's errors with their rules.\n\n```sh\nnpm i -D @reactivescript\u002Flanguage-server typescript\nnpx rx-tsc --noEmit\n```\n\nIt reads `tsconfig.json`, whose `include` must name the `.rx` files\n(`\"include\": [\"src\"]` or `[\"src\u002F**\u002F*.rx\", \"src\u002F**\u002F*.ts\"]`), with Solid's JSX:\n`\"jsx\": \"preserve\"`, `\"jsxImportSource\": \"@solidjs\u002Fweb\"`.\n\nHow releases are made: [`tooling\u002FRELEASING.md`](tooling\u002FRELEASING.md) and\n[`compiler\u002FREADME.md`](compiler\u002FREADME.md).\n\n## Try it\n\nYou need Node 22 or later. The checker and the interpreter run straight from\nthe repo with no install:\n\n```sh\ngit clone https:\u002F\u002Fgithub.com\u002Fsolidjs\u002Freactivescript && cd reactivescript\nnode --experimental-strip-types ref\u002Fcheck.ts examples\u002Ftodo.rx   # check a program\nnode --experimental-strip-types ref\u002Frun.ts                      # run every scenario\n```\n\nRunning the scenarios on Solid itself needs Solid's `next` branch built from\nsource (pnpm and a Rust toolchain); see [CONTRIBUTING.md](CONTRIBUTING.md) and\n[`ref\u002FREADME.md`](ref\u002FREADME.md). The compiler builds with Cargo\n([`compiler\u002FREADME.md`](compiler\u002FREADME.md)). To try an unreleased editor build, install a `.vsix` from a run of the\nrepository's `editor` workflow, or build one\n([`tooling\u002Fvscode-rx\u002FREADME.md`](tooling\u002Fvscode-rx\u002FREADME.md)).\n\n## Reading the spec\n\nThe spec is the product: every behaviour claim is a numbered rule or a\nscenario. A good order for a first read is\n[00 vocabulary](spec\u002F00-vocabulary.md) (each term mapped to Solid's),\n[01 scopes](spec\u002F01-scopes.md), [02 core](spec\u002F02-core.md), then\n[07 surface](spec\u002F07-surface.md) for the syntax and\n[08 constraints](spec\u002F08-constraints.md) for what the compiler refuses.\nSemantics come from Solid 2.0 (`solidjs\u002Fsolid@next`); where this spec departs\nfrom Solid it records a `DV-n`.\n\n### Layout\n\n```\nspec\u002F\n  00-vocabulary.md     the nouns; each mapped to its Solid 2.0 term\n  01-scopes.md         reactive vs imperative scope; lexical inheritance\n  02-core.md           the synchronous calculus: syntax, static rules, instants, pre, causality\n  03-regions.md        ownership, disposal, escape\n  04-rows.md           effect rows: pending, lane, io, fails; inference\n  05-holds.md          the two-version store; Solid's F-1…F-12 restated over the calculus\n  06-stores.md         structured types, paths, draft, key\u002Freconcile, follows\n  07-surface.md        concrete syntax — written LAST\n  08-constraints.md    what the compiler refuses, how, and the escape (Rust stance)\n  09-modules.md        .rx modules: what an import binds, the value boundary, signatures\n  10-server.md         SSR as the streamed mount; what runs where; hydration; what crosses\n  11-compiler.md       the production compiler: a crate on solidjs-compiler; the one seam it needs\n  12-server-functions.md  server fn (io inferred, the call site decides); the server and client rows; the wire\n  13-types.md          types: the program projected to TSX and checked by TypeScript\n  99-diagnostics.md    Solid 2.0's diagnostic table, each code binned: unwritable \u002F static \u002F runtime\nscenarios\u002F             one file per scenario: program, action, frames, compiles-or-rejects\nref\u002F                   interpreter, checker, Solid oracle, compiler and server runner (TypeScript) — all run scenarios\u002F\n```\n\n### Discipline\n\n1. **Core before holds.** `02-core.md` is finished and `ref\u002F` passes its scenarios\n   before `05-holds.md` opens. The two are separate documents on purpose.\n2. **Rules and screens, not prose.** Every claim is a numbered rule or a scenario\n   (program → action → frames → verdict). A section that cannot be written that\n   way is not ready.\n3. **One grammar.** `07-surface.md` is the concrete syntax; `ref\u002F` parses it\n   and every scenario is written in it. `02-core.md §1` keeps the abstract\n   syntax the rules are stated over.\n4. **Solid's fundamentals are upstream.** `05-holds.md` inherits\n   `packages\u002Fsignals\u002Fdocs\u002FRULES-FUNDAMENTALS.md` from `solidjs\u002Fsolid@next`. An\n   open question there (Q-n) is open here; this spec does not rule on it.\n\n### Rule IDs\n\n- `V-n` vocabulary (00) · `SC-n` scopes (01)\n- `E-n` equations · `W-n` writes · `C-n` causality · `P-n` properties of an instant · `EF-n` effects · `IO-n` io (02)\n- `O-n` ownership · `RG-n` regions · `PT-n` portals (03)\n- `R-n` rows · `R-f-n` failures · `R-io-n` io (04)\n- `H-n` holds, each citing the Solid `F-n` it restates; `DV-n` divergences from Solid, recorded per scenario (05, 10)\n- `ST-n` stores · `AC-n` actions (06) · `CSS-n` scoped styles (07) · `CN-n` constraints (08)\n- `MO-n` modules (09) · `SV-n` server (10) · `CP-n` compiler (11) · `SF-n` server functions (12) · `TY-n` types (13)\n- Diagnostics keep Solid's codes (`UNHANDLED_FAILURE`), binned in 99.\n\nScenario IDs: `S-\u003Carea>-n` for the areas above (`S-core`, `S-region`,\n`S-hold`, `S-store`, `S-action`, `S-fail`, `S-module`, `S-server`, `S-sf`,\n`S-types`, …), `S-solid-n` for a port of Solid's `SCENARIOS.md` `S-n`, and\n`S-app-*`, `S-ai-*`, `S-ai2-*` for the example apps under `examples\u002F`.\n\n### References\n\n- **Revisiting ReactiveScript** —\n  \u003Chttps:\u002F\u002Fhackmd.io\u002F@0u1u3zEAQAO0iYWVAStEvw\u002FBktlDvq9R>. Earlier thinking\n  (before TSRX), kept for the record; later decisions supersede it where\n  they differ. The case for the language as *strictness*, narrowed to two\n  concerns, and where this spec answers each:\n  - *Signals vs stores* — one `source`, atomic or structured behind a signal\n    slot (06 ST-1, ST-2a); a mutable derivation is a `draft` (ST-3, its\n    `$project`); `$memo` is an equation (E-1), `$async` an `await` in an\n    equation's tail (R-1).\n  - *Read vs write* — writes only in imperative scope (W-1, W-2), only by\n    the declaring region or what it nests (W-5, O-4); an imported source is\n    read-only and is written through the actions its module exports (09\n    MO-2a).\n  - *Reactivity crossing a function boundary* (its open question: what a\n    `$` function may return) — reactivity is a property of names, not\n    values: a `ref` parameter takes an equation by reference (E-9), an\n    instantiating `fn` runs once and its tail is bound as an equation in\n    the caller (03 RG-6), and a writer crosses only as an `action` the\n    tail carries (`{ value: n, inc }`), never as a setter.\n  - *Superset of `.tsx`, no SFCs* — superseded: expressions and JSX are\n    TS's verbatim and a file is a module (07 §1); declarations are keywords\n    (`source`, `x = e`), as 07 rules.\n\n## License\n\n[MIT](LICENSE)\n","ReactiveScript 是一种专为响应式 UI 设计的轻量级领域特定语言（DSL），将 Solid 2.0 的响应式语义（如信号、派生、所有权）提升为语言级约束，并在编译期静态检查违规行为。核心功能包括：基于 `source`\u002F`equation`\u002F`action` 的显式响应式建模、对非法写入、异步状态泄漏、跨作用域值逃逸等常见错误的零运行时开销静态拒绝，以及面向 AI 友好的可解释错误提示。它编译为标准 Solid 2.0 代码，无运行时额外开销，适用于需强响应式正确性保障的中大型 Solid 应用开发、教学演示及 AI 辅助编程场景。","2026-11-24 04:41:17","CREATED_QUERY"]