Norm 0.13
Norm 0.13 integrates annotations into the unified object model and adds definition-side function, parameter, and field lifecycles.
Language
- An
annotationis an identity aggregate with fields, explicit constructors, ordinary methods, and direct construction. - Annotations declare their policies through Target and Retention interfaces from
std.annotation. FunctionTargetprovidesbefore,around, andafterlifecycle methods for functions and concrete methods.ParameterTarget<T>provides a strongly typed, value-replacingbeforeand completion-onlyafterfor function, method, and constructor parameters.FieldTarget<T>provides strongly typedbeforeand completion-onlyafterhooks for field initialization, assignment, and indirect writes throughref<T>.- Interceptors nest in source order, while dynamic dispatch and function references preserve definition-side behavior.
- Each application constructs one annotation instance per execution and shares it with runtime reflection.
std.validationprovides strongly typed built-in constraints and structuredConstraintViolationexceptions over the parameter and field lifecycles.
Migration
Replace 0.12 targets(...) retention(...) declarations with std.annotation policy interfaces:
norm
import std.annotation.RuntimeRetention
import std.annotation.TypeTarget
annotation Label implements TypeTarget, RuntimeRetention {
String text
}Annotations now follow class construction rules. Declare an explicit constructor for custom initialization; application argument names come from that constructor.
Toolchain
- Syntax, Semantic, Bound, Core, and Truffle share the aggregate definition path.
- Core callable parameters and aggregate fields carry names, types, and ordered interceptors; the identity boundary advances to Schema V9 and Language Semantics V9.
- The formatter, Language Server, VS Code grammar, and cross-package execution support the new declaration model.
See the annotation specification, annotation grammar, validation API, and annotation tour for the complete rules.