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 0140638
Browse filesBrowse the repository at this point in the historyBrowse files
Allow a guess over an equation (Solid's createOptimistic(fn)) (#48)
* Rename the `optimistic` statement to `guess`
`guess x := e` replaces `optimistic x := e` (07 decision 18, ruled
2026-11-11). Semantics and lowering are unchanged (createOptimistic /
createOptimisticStore); only the surface word moves.
- Parsers (ref/src/parse.ts, compiler/src/parse.rs): `guess` is the
keyword; `optimistic` stays reserved and is a parse error coded
OPTIMISTIC whose hint names `guess` (guide/diagnostics.md, S-parse-hints).
- Codes: OPTIMISTIC_OUTSIDE_HOLD -> GUESS_OUTSIDE_HOLD,
OPTIMISTIC_NO_QUESTION -> GUESS_NO_QUESTION, OPTIMISTIC_REVERTED ->
GUESS_REVERTED; HELD_WRITE / STALE_WRITE_BACK / AC-1b messages say `guess`.
- Spec, guide, scenarios, examples, eval reference apps and the editor
grammar use `guess`. eval/results and preregistrations are left as
historical records.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWP7LmQhib6M9zGnmBH
* Don't reserve `optimistic`: it names Solid's primitive, not a keyword
Drops the OPTIMISTIC parse hint, its guide section, spec row and
S-parse-hints variant; 07 decision 18 says why.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWP7LmQhib6M9zGnmBH
* Clear errors with onFlush, not a guess
An error clear is a reset that lands now (EF-8), not a guess at the
server's answer: `guess saveError := ""` worked only because the source
was given a constant question to revert to. The guide's action example,
the examples and the eval reference apps now write
`onFlush(() => { saveError := "" })`, and those error sources are
declared with `:=`. S-ai2-settings gains the flush instant.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWP7LmQhib6M9zGnmBH
* Allow a guess over an equation (Solid's createOptimistic(fn))
`x = e` then `guess x := v` in an action is legal (06 ST-5c, 07 decision
19): a guess is not a write of the truth, and Solid's derived
createOptimistic(fn) has a setter that only guesses. A plain `x := v` on
an equation stays WRITE_TO_NON_SOURCE; `props.x` and parameters stay
refused (O-4). New code GUESS_ON_DEFERRED: a deferred equation lags its
truth (V-16).
Lowering: a guessed equation is createOptimistic(fn), or
createOptimisticStore(fn, seed) when keyed or guessed by path, on the
client, the server (matching owner trees for hydration) and in the oracle.
Both checkers and both emitters agree (crate parity, lowered alike).
Scenario S-guess-equation covers an equation of a source and a child's
equation of a prop.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWP7LmQhib6M9zGnmBH
* Scenario: a guess by path over a keyed equation (createOptimisticStore(fn, seed))
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0117BoWP7LmQhib6M9zGnmBH
---------
Co-authored-by: Claude <noreply@anthropic.com>
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
constplain=()=>{thrownewError("a plain write to an optimistic store is not lowered yet");};
180
180
return[get,{set: plain,path: plain,guess: (v,keys=[])=>setStore((d: any)=>{if(keys.length===0)returntypeofv==="function" ? (vas(x: unknown)=>unknown)(d) : v;/* a whole guess is the setter\'s return, which Solid diffs shallowly against the view as guesses */leto=d;for(constkofkeys.slice(0,-1))o=o[k];constlast=keys[keys.length-1];o[last]=typeofv==="function" ? (vas(x: unknown)=>unknown)(o[last]) : v;})}];
181
181
}
182
+
if(mode.optimistic&&mode.derived){// AC-3 over an equation: createOptimistic(fn), whose setter only guesses
183
+
constplain=()=>{thrownewError("a plain write to an equation");};
constplain=()=>{thrownewError("a plain write to an optimistic store is not lowered yet");};
190
190
return[get,{set: plain,path: plain,guess: (v,keys=[])=>setStore((d: any)=>{if(keys.length===0)returntypeofv==="function" ? (vas(x: unknown)=>unknown)(d) : v;/* a whole guess is the setter\'s return, which Solid diffs shallowly against the view as guesses */leto=d;for(constkofkeys.slice(0,-1))o=o[k];constlast=keys[keys.length-1];o[last]=typeofv==="function" ? (vas(x: unknown)=>unknown)(o[last]) : v;})}];
191
191
}
192
+
if(mode.optimistic&&mode.derived){// AC-3 over an equation: createOptimistic(fn), whose setter only guesses
193
+
constplain=()=>{thrownewError("a plain write to an equation");};
Copy file name to clipboardExpand all lines: ref/oracle/lower.ts
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -282,6 +282,19 @@ export class Oracle {
282
282
scope.vars.set(d.name,{k: "memo",get: ()=>proj});
283
283
break;
284
284
}
285
+
if(this.optimisticTargets.has(d.name)&&!d.deferred){// AC-3 over an equation: Solid's createOptimistic(fn) / createOptimisticStore(fn, seed) — derived, its setter only guesses
286
+
constcompute=this.computeOf(d.name,d.e,scope);
287
+
constplain=()=>{thrownewUnsupported("a plain write to an equation");};
constsrc=createMemo(()=>compute(undefined)asany,this.loadingValue(d.e,scope)asany);// the answer (sync, or the tail await's) is a memo; the projection reconciles it by key (found by S-ai2-search)
0 commit comments