Skip to content

[Enhancement] - Error Numbers / Categories for runtime failures #27

Description

@DerekCorniello

Summary

Companion to muxlang/mux-compiler#314, which proposes numbered/categorized
compiler diagnostics and explicitly notes a similar issue is needed here. That
scheme reserves a runtime band:

E0600  runtime

Runtime failures today are bare panic strings with no stable identifier, so
they cannot be documented, searched, or matched on by tooling the way a coded
diagnostic can.

Scope

Everything the runtime aborts or panics on from a compiled Mux program:

  • index out of bounds (list read/write after normalization)
  • map key not present
  • division / modulo by zero
  • integer overflow where checked
  • where-clause constraint violation at runtime (the documented fallback when
    a violation is not provable at compile time)
  • allocation failure, and other internal invariants

Open design questions

  • Numbering ownership. The compiler and runtime are versioned and released
    independently, so a shared code space needs an owner. Options: reserve a
    fixed band per repo (E0600-E0699 here) and keep the registry in mux-context,
    or namespace runtime codes separately.
  • Where the registry lives. A machine-readable list (one file, checked in
    CI as the single source of truth) beats codes scattered across panic sites,
    and gives the docs site something to generate a diagnostics index from.
  • Message format. Whether the code prefixes the panic text, and whether a
    runtime panic prints a doc URL the way rustc's --explain does.

Depends on

The category layout in muxlang/mux-compiler#314 should be settled first, since
this is one band inside it.

Metadata

Metadata

Labels

enhancementImprovement to existing behavior or UX

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions