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
D28 ruling 2 (Eric, 2026-07-31): the view-token mechanism's new shape.
§3.3 bans reference fields, so a Copy view token cannot respell its str
fields as &str — exactly the gap D27 ruling 1's reopen clause anticipated
('mechanism, not intent'). The blessed destination: extend the EXISTING ephemeral type marker (precedent: pub type ScopedJoinHandle ephemeral
in lib/std/thread.w; §3.4 ephemeral-return propagation) to structs with view
fields.
Semantics sketch (normative wording goes to Eric before landing)
A struct declared ephemeral may contain view fields (&str, &[T], other view types).
The struct is itself second-class: parameters, locals, and returns only —
no heap containers, no non-ephemeral struct fields, no escaping-closure
captures, no globals (§3.3's list, applied to the struct as a whole).
Ephemerality propagates through returns exactly like §3.4 chains — no
lifetime annotations, ever ('This restriction eliminates lifetime
annotations entirely' stays true).
Such a struct may opt into Copy — copying views is copying views.
Origin tracking: the struct value carries its fields' origins; D22
view-origin rules apply through field projection.
Payoff
JsonView re-acquires by-value Copy (D27 ruling 1's declared
signatures stand unchanged); Package/ProjectInfo/Diagnostics can
return to cheap by-value passing where they are genuinely views. Interim
state after #747's de-Copy is borrow-at-boundaries, which D5 auto-ref makes
spelling-invisible.
Dependencies
After #747 (the str flip) — the de-Copy interim is acceptable and this
campaign is not on the roundtrip's critical path. Spec text requires Eric's
blessing of exact wording (AGENTS.md: spec changes are solemn).
Reopen trigger recorded in D28
If ephemeral view-struct origin tracking proves irreconcilable with §3.4's
propagation chains, surface to Eric — do not narrow the doctrine.
Triage 2026-08-31: CLOSE (overcome by events). D28 ruling 2 landed: the spec carries the ephemeral-struct text, JsonView ephemeral: Copy is live (lib/std/json.w:24), and probes confirm both directions (view-field ephemeral struct passes by value; a plain struct with &str is rejected). One note for the record: a local Vec[ephemeral-struct] currently compiles — legal under the landed propagation text, but if "no heap containers" was intended literally that deserves its own narrow issue.
Activity
compiler/std: #747 groundwork — de-Copy str-bearing view tokens; owne…
WIP withlang-dev#747: wrapper handles 'return <expr>' + complex singl…
WIP withlang-dev#747: str transform results are owned copies, never v…
WIP withlang-dev#747: STR_SLICE intrinsic copies — the zero-copy view…
ehartford commentedon Aug 31, 2026
Triage 2026-08-31: CLOSE (overcome by events). D28 ruling 2 landed: the spec carries the ephemeral-struct text,
JsonView ephemeral: Copyis live (lib/std/json.w:24), and probes confirm both directions (view-field ephemeral struct passes by value; a plain struct with &str is rejected). One note for the record: a localVec[ephemeral-struct]currently compiles — legal under the landed propagation text, but if "no heap containers" was intended literally that deserves its own narrow issue.