Skip to content

Commit 7247869

Browse files
olwangclaude
andcommitted
spec: move 4 directions into scope; remove spawn + open enums as non-goals
Per direction: promote the design-compatible deferred directions to a committed in-scope roadmap, and DELETE the two anti-principle items rather than keep them. In scope (new §20.2, cross-referenced from §20.1-B/C/G/I and §3.2): - scoped views / slices, capability objects / explicit dynamic dispatch, cross-isolate message API, two-tier execution. All design-compatible. Removed (not deferred) — stated as firm non-goals (§21): - unstructured spawn / public task handles (breaks single-isolate structured concurrency; task_group is the form; compiler still rejects spawn). - Rust-style open enums (breaks sealed-sum exhaustiveness + review diffs). Dropped both from the §3.2 review-visible list and reframed the §14.6 dynamic- dispatch subsection from "deferred" to "in scope, not yet implemented" (it must still not be described as implemented until built). Updated the spec-guard test accordingly and regenerated docs/spec-todo.md with the 4 open items. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e245ea2 commit 7247869

4 files changed

Lines changed: 146 additions & 120 deletions

File tree

crates/rsscript/tests/checker_package/misc.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ fn package_manager_spec_uses_current_http_and_env_facade_shapes() {
7070
}
7171

7272
#[test]
73-
fn rss_spec_keeps_protocol_dynamic_dispatch_deferred() {
73+
fn rss_spec_keeps_protocol_dynamic_dispatch_unimplemented() {
74+
// Dynamic dispatch is now a committed in-scope roadmap item (§20.2), but it is
75+
// still NOT implemented: the spec must not describe it as implemented, settled,
76+
// or available to package contracts until it is actually built.
7477
let spec = fs::read_to_string(common::language_spec_path())
7578
.unwrap_or_else(|error| panic!("RSScript spec should read: {error}"));
7679

@@ -86,7 +89,8 @@ fn rss_spec_keeps_protocol_dynamic_dispatch_deferred() {
8689
"protocol dynamic dispatch must remain deferred, found `{forbidden}`"
8790
);
8891
}
89-
assert!(spec.contains("Dynamic dispatch (deferred, not admitted in v"));
92+
assert!(spec.contains("Dynamic dispatch (in scope §20.2; not yet implemented)"));
93+
assert!(spec.contains("does not yet implement protocol-typed dynamic dispatch"));
9094
assert!(spec.contains("The only implemented and specified protocol call form is"));
9195
assert!(spec.contains("explicit `Protocol.method(...)` dispatch"));
9296
}

crates/rsscript/tests/fixtures/fail/spawn-not-executable.rss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// expect: RS0015
2-
// `spawn` is review-visible but not executable in v0.6; it must be rejected before
3-
// lowering (the lowerer's Spawn arm is `unreachable_lowering`).
2+
// `spawn` is a firm non-goal (spec §21, §20.2): unstructured task creation breaks
3+
// the single-isolate structured-concurrency model, so it is rejected before
4+
// lowering (the lowerer's Spawn arm is `unreachable_lowering`). Use `task_group`.
45
features: async, local
56

67
async fn work() -> Int {

docs/RSScript_v0.7_Spec.md

Lines changed: 63 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -660,14 +660,16 @@ REIR adapter for capability-binding evidence
660660
The following may be parsed and surfaced for review but are not executable lowering targets in v0.7:
661661

662662
```text
663-
spawn (unstructured task creation)
664663
public Future / Waker / task-handle surface
665-
Rust-style open enum machinery beyond sealed RSScript sum types
666664
general user FFI
667-
advanced protocol/dynamic dispatch model (capability objects)
668-
scoped views / slices
665+
advanced protocol/dynamic dispatch model (capability objects) → now in scope (§20.2)
666+
scoped views / slices → now in scope (§20.2)
669667
```
670668

669+
(Unstructured `spawn` and Rust-style open enums were previously listed here; both
670+
are now firm non-goals, see §21 and §20.2 — `spawn` is still rejected with a
671+
stable diagnostic.)
672+
671673
`async fn` signatures are review-visible contracts. v0.7 admits an executable async
672674
MVP: `await` appears inside an `async fn` at a statement boundary, inside an
673675
`if`/`loop`/`match`/`with` body, or **nested in an expression** — an `await` in a
@@ -3640,17 +3642,19 @@ short-circuit `&&`/`||`, which is only conditionally evaluated. Hoisting it woul
36403642
force unconditional evaluation, so such an `await` stays rejected as a non-linear
36413643
await (`RS0411`).
36423644

3643-
#### Dynamic dispatch (deferred, not admitted in v0.7)
3645+
#### Dynamic dispatch (in scope §20.2; not yet implemented)
36443646

3645-
RSScript v0.7 does not admit protocol-typed dynamic dispatch, trait objects, or
3646-
protocol-typed values. The only implemented and specified protocol call form is
3647+
RSScript v0.7 does not yet implement protocol-typed dynamic dispatch, trait
3648+
objects, or protocol-typed values.
3649+
The only implemented and specified protocol call form is
36473650
static, explicit `Protocol.method(...)` dispatch backed by an explicit generic
36483651
bound or an explicit `impl Protocol for Type` declaration.
36493652

3650-
Future protocol dynamic dispatch is a design target, not a v0.7 promise. It must
3651-
go through feature admission again and must not be described as implemented,
3652-
settled, or available to package contracts until syntax, checking, lowering,
3653-
review evidence, and package metadata exist together.
3653+
Explicit, review-visible `capability`-bounded dispatch is now a **committed
3654+
roadmap item** (§20.2-2, §20.1-G) — not Rust-style implicit `dyn` coercion, which
3655+
stays a non-goal (§21). Until it is built, it must not be described as
3656+
implemented, settled, or available to package contracts: syntax, checking,
3657+
lowering, review evidence, and package metadata must land together.
36543658

36553659
Closed sets should still prefer sealed sum types with exhaustive match
36563660
(section 20.1), which are strictly more reviewable. For open sets such as
@@ -5271,6 +5275,7 @@ A. Extended async surface beyond the v0.7 MVP
52715275
- must not expose Future / Pin / Poll / Waker to RSScript users (section 14.4).
52725276
52735277
B. Cross-isolate message API with zero-copy transfer
5278+
- now in scope: committed roadmap (§20.2).
52745279
- explicit typed send/receive channels between isolates.
52755280
- cross-isolate payloads are owned/Copy data or values moved with take.
52765281
- take-based move across an isolate boundary is the no-shared-alias transfer
@@ -5279,6 +5284,7 @@ B. Cross-isolate message API with zero-copy transfer
52795284
- managed handles never cross isolates; only explicit messages do.
52805285
52815286
C. Two-tier execution: dev interpreter + Rust-lowering AOT
5287+
- now in scope: committed roadmap (§20.2).
52825288
- a HIR-level interpreter for the managed subset for a fast edit-run loop,
52835289
since rustc compilation cost is poor for inner-loop iteration.
52845290
- the Rust-lowering path remains the production/AOT target.
@@ -5315,6 +5321,7 @@ F. Registry-level review-risk badges
53155321
signals to derive from compiler/package review evidence.
53165322
53175323
G. Capability objects (explicit dynamic dispatch)
5324+
- now in scope: committed roadmap (§20.2).
53185325
- RSScript does not adopt Rust-style `dyn Trait` with vtable coercion.
53195326
- if dynamic dispatch is needed, it must use an explicit capability-bounded
53205327
form that is visible to review:
@@ -5344,6 +5351,7 @@ H. Stream<T> and await-for (async sequences)
53445351
or `Stream` combinators that hide allocation.
53455352
53465353
I. Scoped views and slices (zero-copy borrowed regions)
5354+
- now in scope: committed roadmap (§20.2).
53475355
- for high-performance parsing, HTTP buffers, and binary protocols, RSScript
53485356
needs a "borrowed view" that avoids full-copy semantics:
53495357
@@ -5444,6 +5452,48 @@ positional records / conflicts with named-everything canonical style;
54445452
implicit flow promotion any record-like form must use named fields
54455453
```
54465454

5455+
### 20.2 In scope: committed implementation roadmap
5456+
5457+
The following directions — previously deferred (§20.1) or listed as
5458+
review-visible-but-not-executable (§3.2) — are now **committed in-scope work**
5459+
targeted for implementation, tracked as open items in `docs/spec-todo.md`. All
5460+
four are design-compatible: large, but they extend the model without reversing a
5461+
review-first tenet.
5462+
5463+
```text
5464+
1. Scoped views / slices (zero-copy borrowed regions) — §20.1-I, §3.2.
5465+
Lexically-scoped borrowed views (`with Buffer.view(...) as bytes { ... }`, or
5466+
`view bytes = ...`) that cannot be retained, escape their scope, cross an
5467+
await, or enter managed graphs. No surface lifetimes. Design-compatible; large.
5468+
5469+
2. Capability objects / explicit dynamic dispatch — §20.1-G, §3.2.
5470+
Review-visible `capability`-bounded dispatch (`store: read capability Store<T>`),
5471+
NOT Rust-style implicit `dyn` coercion (which stays a non-goal, §21). The review
5472+
map must flag every capability boundary. Design-compatible; large.
5473+
5474+
3. Cross-isolate message API (zero-copy transfer) — §20.1-B.
5475+
Typed send/receive channels between isolates; payloads are Copy/owned data or
5476+
values moved with `take`; managed handles never cross. Depends on the isolate
5477+
model; design-compatible; large.
5478+
5479+
4. Two-tier execution (dev interpreter + AOT) — §20.1-C.
5480+
The reg-VM and the Rust-lowering backend already run at parity; this commits to
5481+
the fast HIR-level dev loop as a first-class tier. Infrastructure, not new
5482+
surface — both tiers must keep identical semantics and diagnostics.
5483+
```
5484+
5485+
These four override the corresponding "not adopted" / "not executable in v0.7"
5486+
notes in §3.2 and §20.1 for those features.
5487+
5488+
**Removed, not deferred.** Unstructured `spawn` / public task handles and
5489+
Rust-style open enums were previously listed as future directions. They are
5490+
*deleted* from the roadmap, not merely deferred, because they contradict core
5491+
RSScript principles: `spawn` breaks the single-isolate, structured-concurrency
5492+
model (`task_group` is the sanctioned form), and open enums break the sealed-sum
5493+
guarantees that make match-exhaustiveness and review-diffs sound. Both are stated
5494+
as firm non-goals (§21); the compiler continues to reject `spawn` with a stable
5495+
diagnostic.
5496+
54475497
---
54485498

54495499
## 21. Non-goals
@@ -5457,6 +5507,8 @@ LLVM backend
54575507
JIT
54585508
surface Rust lifetimes
54595509
surface & / &mut
5510+
unstructured spawn / public task handles (breaks single-isolate structured concurrency; use task_group)
5511+
Rust-style open enums / open sum extension (breaks sealed-sum exhaustiveness + review diffs)
54605512
Rust-style traits as source semantics
54615513
associated types
54625514
blanket impls

0 commit comments

Comments
 (0)