Xenon language

Documentation

Language concepts, syntax and behavior.

01

Language foundation

Core

Language

Types

Primitive types

Integers, floating-point values, booleans and void.

Read chapter
Values

Literals and variables

Create values and store them in typed local variables.

Read chapter
Mutability

const and readonly

Separate compile-time constants from runtime read-only access.

Read chapter
Declarations

Functions

Free functions, parameters, calls, return values and the entry point.

Read chapter
Control flow

Await and resumable functions

Library-defined suspension, completion and continuation lifetimes.

Read chapter
Visibility

Access modifiers

Control which functions and struct members are visible to other code.

Read chapter
Expressions

Operators

Arithmetic, comparison, boolean, bitwise and assignment operators.

Read chapter
Type behavior

Operator overloading

Every supported unary/binary operator, conversions, compound assignment and declaration restrictions.

Read chapter
Concurrency

Atomic values

Indivisible primitive reads, writes and read-modify-write operators.

Read chapter
Concurrency

Thread-local storage

Per-native-thread static fields with lazy initialization and normal ownership cleanup.

Read chapter
Concurrency

Memory model and data races

Ordinary and atomic access rules, undefined races, ownership and synchronization boundaries.

Read chapter
Statements

Branching

Select a path with if, else and switch over integer or enum values.

Read chapter
Iteration

Loops

Repeat work with while and for, then control iteration explicitly.

Read chapter
Control flow

Exceptions

Throw typed values, handle them with catch and guarantee cleanup with finally.

Read chapter

Type system

Types

Structs

Define structured types, choose stack or heap storage and add behavior.

Read chapter
Initialization

Constructors

Initialize instances, select overloads and construct base types before derived fields.

Read chapter
Cleanup

Destructors

Release resources, chain base cleanup and destroy array elements.

Read chapter
Ownership

Move semantics

Transfer a local value and its deterministic cleanup responsibility explicitly.

Read chapter
Single ownership

unique ownership

Hold exclusive ownership of a heap allocation, transfer it with move and release it automatically.

Read chapter
Reference-counted ownership

shared and weak ownership

Share an allocation safely, observe it weakly and upgrade observers with the lock expression.

Read chapter
Low-level lifetime control

storage and pin

Construct values in typed storage, control destructor responsibility and guarantee stable addresses.

Read chapter
Named values

Enums

Define distinct integer-backed types with named constant values.

Read chapter
Relationships

Inheritance

Extend one struct, initialize its base and preserve layout compatibility.

Read chapter
Contracts

Interfaces

Describe behavior and dispatch through interface references.

Read chapter
Generics

Generic templates

Use compile-time generic declarations, constraints and structural contracts.

Read chapter
Polymorphism

Abstraction and virtual dispatch

Define virtual behavior, abstract requirements and concrete overrides.

Read chapter
Type members

Static members

Store shared state and call behavior through a struct type.

Read chapter
Accessors

Properties and indexers

Expose controlled member and indexed access through getters and setters.

Read chapter
Aliasing

References

Alias existing values with mutable or readonly typed access.

Read chapter