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

Native reflection

Inspect and operate on native types through compiler-generated 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 →

Reflection belongs to the language

Sn's reflection surface describes native types and their fields, properties, methods, and attributes. The compiler generates the corresponding metadata. A caller uses ordinary Sn APIs instead of inventing a parallel type-description format for each tool.

Find a type or member

TypeOf<T>() returns a type descriptor. TypeInfo provides member queries, including FindField, FindProperty, and FindMethod. Stable type identities are distinct from object addresses and layout hashes.

Work with real values

The public API includes checked field reads and writes, property getter/setter access, and method invocation. Reflected values preserve type and access information. Borrowed views do not take ownership of the objects they describe.

Build tools from the metadata

An engine inspector can enumerate editable fields, a serialization system can inspect the fields it needs to persist, and a tool can discover application-specific attributes. These are uses for the reflection APIs, not claims that a complete inspector or serializer comes bundled with the compiler.

Typed attributes

Attributes have typed values, not just names or unstructured strings. Retained attributes can be queried through direct or effective inherited views. The API supports typed lookup and immutable frozen attribute values.

Lifetime and access still apply

A reflected view does not extend an object's lifetime or bypass its access contract. Runtime operations report validation status, and explicitly authorized private access is separate from normal public reflection.

Source and implementation status

The standard library contains the public descriptors and operations, with compiler and LLVM backend support for their metadata and calls. Whole-project validation remains incomplete; check the selected release's known limitations.

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