Skip to content

Norm 0.5 ​

Norm 0.5 unifies closed data, nominal behavior abstraction, and contextual type inference. This page defines the 0.5 implementation contract; the language specification remains authoritative for syntax and type rules.

Data and control flow ​

  • Generic data-enum variants may carry distinct fields.
  • Patterns support variants, typed bindings, literals, null, wildcards, and recursive destructuring.
  • Every switch is checked for exhaustiveness, matches in source order, and has no fallthrough.
  • Switch expressions use break value, and the scrutinee is evaluated once.
  • std.core.Result<T, E> and Unit are defined in ordinary Norm source.

Interfaces and protocols ​

  • Interfaces are the sole nominal behavior abstraction and support type parameters, multiple parent interfaces, and generic bounds.
  • Classes establish relationships through explicit implements; interface calls dispatch on the concrete type.
  • Core IR retains interface requirements, conformances, and witnesses, and verifies their complete closure before execution.
  • Iterable<T>, Iterator<T>, Sized, Comparable<T>, Equatable<T>, Hashable, and Stringable are ordinary standard-library interfaces.
  • Builtin collections iterate through Iterable<T>, while builtin scalar values participate in typed batch output through Stringable.

Type inference and foundational types ​

  • Type inference combines expected types, expression types, and generic constraint solving.
  • Constructor expressions support diamond inference, including expected-type propagation through nested argument positions.
  • Array and list literals combine contextual and element inference; heterogeneous numeric literals can converge on Number.
  • Unconstrained numeric literals select Integer, Long, or Double; a valid concrete numeric expected type takes priority.
  • Iterable for supports value,index bindings, with the index in the second position.
  • printLines and expectedOutputLines provide typed batch output and test expectations.

Toolchain ​

  • The binder, Core IR, verifier, and Truffle backend share resolved enum, pattern, interface, and witness representations.
  • The Language Server uses the same semantic model for diagnostics, completion, hover, and navigation for the new constructs.
  • The VS Code extension recognizes the new keywords, generic contexts, and current compiler distribution.
  • Standard-library, cross-package interface, and algorithm suites cover compilation and real execution.

See the language specification, data model, enums and switch, and nullability and inference for the complete rules.

Norm 0.25