Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

Typed attributes

Describe how tools should treat a declaration, using typed metadata.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

Declare metadata as a type

Sn has an attribute declaration form. Attribute construction and arguments are evaluated at compile time. The compiler can validate the attribute's fields and application site rather than treating every metadata annotation as an unchecked string.

AttributeUsage specifies targets, repetition, inheritance, and retention. Repeated target-policy declarations must agree; conflicting or invalid policies are diagnosed.

Choose retention

AttributeRetention.Runtime retains the frozen application when reflection is enabled. CompileTimeOnly omits the runtime record while preserving compile-time semantic metadata and effects.

Query the typed value

Reflection exposes direct and effective inherited attribute queries, including typed AttributesOf<A>() and FirstAttribute<A>() forms. Runtime-retained values are immutable frozen views.

Use the declaration as the source of metadata

Engine and application tools can use attributes for editor presentation, serialization policy, and other domain-specific behavior. The attribute describes the policy; the consuming tool implements it. Applying an annotation does not automatically create a serializer or engine feature.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library