Skip to main content
v0.14.0

Metel Language Specification

This document is the single source of truth for the Metel language. Features not described here are not part of the language. Availability in this spec is stated by released or planned versions, not by RFC ids or issue numbers.

Source files use the .mtl extension.

Overview​

Metel is a statically typed, expression-oriented language with a Rust-inspired syntax. This specification describes the language accepted by the current interpreter.

The language's core design principles are:

  • Strong static typing with full Hindley-Milner type inference
  • No classes — data and behaviour are defined separately via structs, enums, and aspects
  • Algebraic data types — enums with data-carrying variants and exhaustive pattern matching
  • Explicit nullability — absence of a value is represented by Perhaps<T>, never by null
  • Explicit error handling — errors are values, represented as Result<T, E>
  • Safe memory by default — affine ownership: a value has one owner, and moves rather than being implicitly copied

    Since v0.12.0 (RFC-0071), behind --move-check: ownership is enforced only when the flag is passed; without it the interpreter behaves as if every value were Copy. See Ownership and Move Semantics.

Contents​

FileContents
Lexical StructureComments, identifiers, keywords, literals, operators
ModulesFiles, modules, imports, path roots, visibility, re-exports
Type SystemPrimitive types, inference, tuples, records and rows, arrays, casting, generics, Never, Perhaps<T>, Result<T,E>
OwnershipMoves, Copy, Drop, drop order, partial moves
DeclarationsVariables, structs, named records, enums, aspects
FunctionsFunctions, closures, the ? operator
ExpressionsPattern matching, control flow
RuntimePanics, built-in functions
GrammarFormal grammar
Error CodesEvery diagnostic the interpreter can report, with a real example
Language Spec HealthHow many Formal Rules are tested, which are exempt and why, and which gaps remain
Limitations and GapsEvery known implementation limitation and specification gap, with its status

See Changelog for version history.