A proposal to add signals to JavaScript
Scope and Motivation of the Proposal
- Goal is to standardize a “signal” primitive: reactive values + dependency tracking + effects.
- Proponents see it as similar to Promises: widely converged-on pattern that should move from libraries into the standard library.
- Claimed benefits:
- Fine‑grained reactivity and less unnecessary recomputation/rerendering.
- Easier interop across frameworks and libraries (shared reactive primitive).
- Better baseline for debugging and devtools because engines understand the primitive.
Comparison to Existing Patterns (Events, Pub/Sub, Getters, Frameworks)
- Many argue existing tools are “good enough”:
- DOM events / EventEmitter / custom pub‑sub.
- Getters/setters, Proxies, and library‑level reactivity (MobX, Vue, Solid, Svelte, etc.).
- React’s hooks and atom-style state management.
- Counter‑arguments:
- Events and pub/sub are harder to compose, leak more easily, and don’t track dependencies automatically.
- Signals can avoid unnecessary work (only recompute when a dependency actually matters) and automatically manage subscriptions.
- Standard signals could underpin UIs, web components, and cross‑framework state, whereas today each framework has its own ecosystem.
Interoperability and Standard Library Debate
- Supporters: nearly all modern frontend frameworks except one major one have some form of signals; standardization would:
- Let framework-agnostic components share reactive state.
- Reduce duplicated implementations and bundle size.
- Align with a broader “batteries-included” trend for JS.
- Skeptics:
- See this as baking a current UI fashion into JS, similar to the failed Observable proposal.
- Argue signals belong in libraries, proven over years, before being frozen in the spec.
- Worry about long‑term complexity and irreversible “language bloat.”
Complexity, Debugging, and Semantics
- Concerns that signal graphs, automatic effects, and implicit dependencies are hard to reason about and debug, especially loops and cascading updates.
- Others reply that:
- Similar problems exist in any observer/publish–subscribe system and are long‑studied.
- Standardization would enable browser‑level introspection and better tooling to trace reactive chains.
- Open/unclear points raised:
- How well signals handle nested object/array mutation, async computations, error propagation, and deep vs shallow reactivity.
- Whether dependency tracking can or should be static vs entirely runtime.