Norm 0.6
Norm 0.6 completes first-class functions, closures, return-type omission rules, and shared source formatting. This page defines the 0.6 implementation contract; the language specification remains authoritative for syntax and type rules.
Functions and closures
Function<R(P...)>is the complete function type. Function values can be stored in variables, fields, and collections, passed as arguments, and returned.- Callable parameter syntax such as
R transform(T value)uses the same type model asFunction<R(T)> transform. - Lambdas support contextual parameter inference, explicit parameter types, trailing-expression results, and generic expected-type propagation.
- Closures capture outer locals, parameters, and
this; captured locals and parameters follow effectively-final rules. - Top-level function references and
receiver::methodbound references resolve overloads from the expected function type. - The binder, Core IR, verifier, and Truffle backend share closure targets, capture layouts, and invocation representations. The content-identity boundary advances to Core Schema V3 and Language Semantics V3.
Function declarations
- An omitted return type on a top-level function is fixed to
Void. - An omitted return type on a class method returns the same receiver and supports fluent calls.
- Interface methods continue to declare their return types explicitly.
- Top-level declarations and members are public by default, and source formatting uses the canonical form that omits
public.
Toolchain
- The compiler provides an AST-based formatter with two-space indentation, a 100-column layout, and a stable trailing newline.
- The Language Server implements standard
textDocument/formattingand leaves invalid source unchanged. - The VS Code extension selects the Norm formatter and enables format-on-save by default.
- Completion, signature help, hover, and symbol presentation understand function types, lambdas, method references, and omitted return types.
- The standard library, examples, and acceptance programs use the canonical format.
Upgrade note
A class method with an omitted return type now has its owner type and returns this on normal completion. Declare Void explicitly when the method should produce no result. An omitted top-level return type continues to mean Void.
See the functions tour, advanced function rules, function declaration syntax, and VS Code support for the complete rules.