An unread equation over two sources makes a write to one wait for an action that holds the other (E-3 against CP-4b's `createMemo`)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, typescript, vite
- Lĩnh vực
- backend, developer-experience
Hướng nghiên cứu
Start with E-3 in spec/02-core.md and CP-4b in spec/11-compiler.md, then trace memo lowering in ref/compile/rt.ts and the runtime memo implementation. Reproduce the supplied two-source case and compare it with the Solid-only example using and without ?lazy. Determine how the lazy behavior affects the documented contract and related cases; done means the conflict and expected semantics are resolved and covered by appropriate documentation and tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Found while building a component library on ReactiveScript. Written with Claude Fable 5.2 (in Claude Code), which also ran the reproductions; all of them were rerun before posting.
@reactivescript/compiler 0.3.1 through @solidjs/vite-plugin 3.0.0-next.57 on a Vite dev server, mounted with
const app = createApp({ root }); app.mount(main(app)) from @reactivescript/runtime 0.3.1, in Chromium, on
solid-js 2.0.0-rc.22 and on 2.0.0. A Playwright script clicks the buttons and reads the text of the <p>
elements.
api.js:
export const wait = (ms, value) => new Promise((resolve) => setTimeout(() => resolve(value), ms));
b.rx:
import { wait } from "./api.js"
export default component App() {
source open := true
source page := 1
both = { open: open, page: page }
action go() {
page := 2
try { await wait(300, 0) } catch (e) { }
}
<div>
<button onClick={() => { go() }}>go</button>
<button onClick={() => { open := false }}>close</button>
<p>open: {open ? "yes" : "no"}</p>
<p>page: {page}</p>
</div>
}
| step | b.rx |
b.rx without the both line |
|---|---|---|
| mount | open: yes, page: 1 |
open: yes, page: 1 |
| click go | open: yes, page: 1 |
open: yes, page: 1 |
| click close | open: yes, page: 1 |
open: no, page: 1 |
| 100 ms later | open: yes, page: 1 |
open: no, page: 1 |
| the wait resolves | open: no, page: 2 |
open: no, page: 2 |
Expected: the right-hand column for both. Nothing reaches both: no reader, no effect, no other equation.
- E-3 (
spec/02-core.md): "An equation's body is evaluated only when a reader, an effect's compute half, or
another demanded equation reaches it in the current instant. Unreached equations have no observable cost or
effect." - V-4 (
spec/00-vocabulary.md): "An equation counts only through the readers that reach it; an effect, a
snapshot read (V-11), or an unread equation is never a reader." - H-3 (
spec/05-holds.md) makes a join a reader's: "a reader that consumes a value derived fromc's held
writes, or a landed answer ofc, joinsc". guide/language.md, "Declarations": "Equations are lazy and exact".
The compiler does what CP-4b (spec/11-compiler.md) pins: memo(name, fn, opts) lowers "an equation (E-1)" over
createMemo, and the runtime's memo is createMemo(named(name, fn), opts2). That memo is eager, so the conflict
is between E-3 and CP-4b. ref/compile/rt.ts has the same createMemo call; I did not run ref/.
The page below is the same program on solid-js alone, with the same clicks. As written it gives the left-hand
column. With ?lazy in the URL it gives the right-hand column.
<!doctype html> <button>go</button><button>close</button>
<p></p>
<p></p>
<script type="module">
import { createRoot, createSignal, createMemo, createRenderEffect, action } from "solid-js";
const lazy = new URLSearchParams(location.search).has("lazy");
const [go, close] = document.querySelectorAll("button");
const [openText, pageText] = document.querySelectorAll("p");
createRoot(() => {
const [open, setOpen] = createSignal(true);
const [page, setPage] = createSignal(1);
createMemo(() => ({ open: open(), page: page() }), lazy ? { lazy: true } : undefined); // never read
const run = action(function* () {
setPage(2);
yield new Promise((r) => setTimeout(r, 300));
});
go.onclick = () => run();
close.onclick = () => setOpen(false);
createRenderEffect(open, (v) => {
openText.textContent = "open: " + (v ? "yes" : "no");
});
createRenderEffect(page, (v) => {
pageText.textContent = "page: " + v;
});
});
</script>
(Served by the same Vite server, which resolves the solid-js import.)
Not tested: what else changes if an equation is emitted with { lazy: true }. Solid's cheatsheet says a lazy memo
will "autodispose when unobserved", and spec/02-core.md already records one lazy-memo divergence, for pre.
- Ngôn ngữ chính
- TypeScript
- Star
- 127
- Fork
- 7
- Merge trung bình
- 15 giờ 42 phút
- Pull request đã merge (30 ngày)
- 63
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của solidjs/reactivescript
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
solidjs/reactivescript#96 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Vite front end keeps serving a failed build after the missing/broken imported module is fixedCó thể đã có người làm @cgaaf đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
solidjs/reactivescript#84 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
solidjs/reactivescript#77 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
solidjs/reactivescript#74 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
solidjs/reactivescript#97 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của solidjs/reactivescript
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
GetStream/stream-chat-react#3467 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
vercel-labs/ui#1139 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10Có thể đã có người làm @goranai đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] IntegerRange.contains counts a non-integer just above max as inside an inclusive rangeĐang mởbot:ai-assisted component:platform-js status:untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
midnightntwrk/platform-js#93 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100