Skip to content

Commit 8c066be

Browse files
olwangclaude
andcommitted
docs(selfhost-ledger): correct SH-018 — inherent methods already exist as fn Type.method(self)
The 'no impl/method syntax' claim was an over-claim (like SH-020). rss has inherent methods as top-level qualified functions with a self receiver (fn Type.method(self: read/mut/take Type)), called via x.method()/mut x.method() (spec §14.6.1) — static, monomorphic, effect-explicit, verified working. The only missing piece is the impl{} block grouping, which the spec deliberately rejects (§2B.2/§2B.3, single-canonical-form). Decision: adopt the existing form; do not add the block. Method syntax RESOLVED, not a follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b84a1a1 commit 8c066be

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

docs/ledgers/rss-selfhost-ledger.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,24 @@ gap is VM value-representation / intrinsic-dispatch cost (the next big lever).
474474
**Copy-scalar** parameter (Int/Bool/Float/Char, …) may be reassigned inside the
475475
callee and the new value is written back to the caller (`&mut` semantics), so a
476476
scanner can take `i: mut Int` and do `i = i + 1` instead of returning the new
477-
index. Method/`impl` syntax remains a separate follow-up.
477+
index.
478+
- **CORRECTION (2026-07-01):** the Symptom's "no `impl`/method syntax" was an
479+
over-claim (same class as SH-020). rss DOES have inherent methods — spelled as
480+
top-level qualified functions with a `self` receiver: `fn Type.method(self:
481+
read/mut/take Type, …)`, called with dot-syntax `x.method(args)` /
482+
`mut x.method()` (spec §14.6.1). Static, monomorphic, one-per-(type,name),
483+
effect-explicit, resolved by the receiver's concrete type in HIR
484+
(`resolve_receiver_call`), lowered like any namespaced function on all backends.
485+
Verified: `fn Lexer.bump(self: mut Lexer) { self.pos = self.pos + 1 }` +
486+
`mut lexer.bump()` mutates and writes back. So a self-hosted lexer CAN
487+
encapsulate its cursor as `fn Lexer.bump(self: mut Lexer)` — the pain was using
488+
free helpers, not a language gap. The ONLY thing rss lacks is the
489+
`impl Type { fn m() }` BLOCK grouping, which the spec DELIBERATELY rejects
490+
(§2B.2/§2B.3: methods are flat qualified functions "not bodies buried in an impl
491+
block"; §2.3 single-canonical-form). Decision (user, 2026-07-01): adopt the
492+
existing `fn Type.method(self:…)` form; do NOT add the `impl` block (it adds no
493+
capability and would reverse a considered spec position). Method syntax is
494+
therefore RESOLVED, not a follow-up.
478495
- **Fix:** the reg-VM already wrote a `mut` param's final register back to the
479496
caller for every `mut` param (scalar included), so no reg-VM/native change was
480497
needed. Only two frontend touch-points were added: (1) the assignment gate

0 commit comments

Comments
 (0)