You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d3cab00
Browse filesBrowse the repository at this point in the historyBrowse files
Guesses over writables: signals and stores (07 decision 21)
guess x := v is legal on any source: a := signal or store, and a source
with a question that is also written plainly. The writable is the truth;
an optimistic layer derives from it (createOptimistic(() => truth()),
createOptimisticStore(() => truth, seed)). Plain writes go to the truth,
guesses to the layer. GUESS_NO_QUESTION is retired.
Scenarios S-guess-writable-1..3. The server runtime creates the layer for
its owner slot only and renders the truth: Solid's server throws
NotReadyError for a projection over a pending store (solidjs/solid#5097,
repro in ref/oracle/repros).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWLtkg281f1NkGEDjCt
Copy file name to clipboardExpand all lines: compiler/src/check.rs
-9Lines changed: 0 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -2513,15 +2513,6 @@ impl<'a> Checker<'a> {
2513
2513
if !ctx.in_action{
2514
2514
self.err("GUESS_OUTSIDE_HOLD","AC-3","a guess outside an action: it needs a hold to live in — an apply block is never an action (its return is the cleanup, EF-5): declare one, `action save(v) { guess … }`, and call it from the block".into());
returnfail(format!("a plain write to {name}, a source with a question that is also guessed by path, is not lowered yet (06 AC-3): guess the server's answer after the `await` instead (`guess {name} := rs => …`, until the re-ask lands), or guess {name} whole (`guess {name} := rs => …`) rather than by path"));
1030
-
}
1031
1032
let lv = self.loading_value(init, env)?;
1032
-
let mode = obj(vec![("optimistic",E::Bool(self.u.optimistic.contains(name))),("structured",E::Bool(self.u.paths.contains(name))),("record",E::Bool(matches!(init.k,ExprKind::Rec(_))))]);
1033
+
let mode = obj(vec![("optimistic",E::Bool(self.u.optimistic.contains(name))),("structured",E::Bool(self.u.paths.contains(name))),("record",E::Bool(matches!(init.k,ExprKind::Rec(_)))),("plain",E::Bool(self.u.plain.contains(name)))]);
1033
1034
let x = self.expr(init, env,&Ctx{tail:true,self_:Some(name.clone()), ..Ctx::default()})?;
if(this.u.optimistic.has(d.name)&&this.u.paths.has(d.name)&&this.u.plain.has(d.name))thrownewCompileError(`a plain write to ${d.name}, a source with a question that is also guessed by path, is not lowered yet (06 AC-3): guess the server's answer after the \`await\` instead (\`guess ${d.name} := rs => …\`, until the re-ask lands), or guess ${d.name} whole (\`guess ${d.name} := rs => …\`) rather than by path`);
lookup(name: string): Entry{constl=registry.get(name);if(!l?.length){if(jsErrors.has(name))return{value: jsErrors.get(name)};thrownewError(`unbound ${name}`);}returnl[l.length-1];},// a server function's request has its module's error classes, not the page's registry
134
134
135
135
// ---- declarations: the same primitives, from the server build. Writes do not happen on the server (SV-2). ----
136
-
source(name: string,init: unknown): [Acc,Writer]{
136
+
source(name: string,init: unknown,guessed=false): [Acc,Writer]{// guessed: the client's optimistic layer over the writable (AC-3), so the owner trees (and hydration keys) match
if(mode.optimistic&&mode.structured&&mode.plain&&!mode.derived){const[truth]=(createStoreasany)(derive,key&&!mode.record ? [] : {},key ? { key } : undefined);(createOptimisticStoreasany)(()=>(key&&!mode.record ? [] : {}),key&&!mode.record ? [] : {},key ? { key } : undefined);returnro(()=>truth);}// the client's layer, created for its owner slot only: the server shows the truth (it has no guesses), since Solid's server runs a projection's fn at once and one over a pending store throws NotReadyError out of the component (solidjs/solid#5097)
if(mode.optimistic&&mode.derived){const[get]=createOptimistic(fnasany,oasany);returnro(getasAcc);}// AC-3 over an equation: the client's createOptimistic(fn), so the owner trees (and hydration keys) match
0 commit comments