Events
Platform spec node
Events
Spec standingStandard
No architecture decision records under adr/ for this feature yet. Standard features must
publish at least one ADR or keep a ## Decisions summary on the hub.
- Control flow Conditionals, loops, and structured control transfer. Lowering to HIR/CLIF follows the evaluation order defined here.
- Events Multicast events, subscription lifetime, and thread affinity assumptions. UI stacks build on these primitives.
- Lambdas and closures Capture lists, environment layout, and lifetime of delegates. JIT and AOT must agree on closure calling conventions.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
scope | yes | yes |
features | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Normative specification
Section titled “Normative specification”Defines event fields on types and their raise/subscribe surface. Fiber cancellation events are specified in Fibers and spawn and the concurrency package.
Declaration
Section titled “Declaration”event Name(params);on atypedeclares a multicast callback slot.- Optional
event {N} Namesets a capacity hint (EventCapacity); runtime may use this for bounded subscriber lists. - Event fields are not ordinary value fields; they must not be read like variables.
Static rules
Section titled “Static rules”- Raising or subscribing must target an in-scope event member on a value or
this-equivalent receiver. - Event signatures must use parameter lists compatible with delegate lowering (no
ref/outon event parameters unless explicitly allowed by host profile).
Dynamic semantics
Section titled “Dynamic semantics”- Multicast: Multiple subscribers may be registered; raise must invoke subscribers in registration order unless a host profile defines fairness.
- Synchrony: Unless a host documents otherwise, event handlers run on the raising fiber and must not block on
Joinof self. - Lifetime: Subscriptions should be detached when the owning object is disposed; leaks are host-defined (corelib hosts document behavior).
Diagnostics
Section titled “Diagnostics”Event misuse must surface as member/type errors (E1213 family) until a dedicated event band is allocated.
Conformance
Section titled “Conformance”Types with event fields must lower to the same calling convention in AOT and JIT for a given target.
Decisions
Section titled “Decisions”- D-LM-EVT-001 — Language
eventkeyword: Events are fields, not separate delegate types in user syntax. - D-LM-EVT-002 — Fiber OnCancelled: Cancellation uses the same
eventmechanism onFiber<T>per concurrency decisions record. - D-LM-EVT-003 — Synchronous default: Handlers run on the raising fiber unless a host profile says otherwise.
- D-LM-EVT-004 — Not
Option: Subscription state is host-managed; absence of subscribers is notOption<T>at the language surface.
Platform view
Section titled “Platform view”Multicast events, subscription lifetime, and thread affinity assumptions. UI stacks build on these primitives.