Docs / Data Structures

3. Type System

Dryad implements a dynamic type system with optional development-time annotations. Types are associated with runtime values rather than directly with variables. However, the compiler has a strict development mode ('use strict types') that enables extreme static optimizations in Ahead-of-Time (AOT) compilations.

Primitive TypeRuntime BehaviorAvailable Literals
numberIEEE 754 f64 floating point (double precision)42, 3.14, 0xFF, 1e10
stringUnicode character sequence decoded in UTF-8"hello", 'world', template
boolClassic boolean representationtrue, false
nullNull/undefined value without representationnull
anyUniversal type (implicit if omitted)Accepts any physical value
Primitive Types, Arrays, and Tuples
 1 // Primitive Types
 2 let idade: number = 32;
 3 let ativa: bool = true;
 4 let nome: string = "Membro da Guilda";
 5 let nulo: null = null;
 6 let indefinida: any = "Pode conter qualquer valor";
 7 
 8 // Arrays: Dynamic and heterogeneous
 9 let lista: number[] = [1, 2, 3];
10 let misto: any[] = [42, "texto", false];
11 
12 // Tuples: Fixed size and heterogeneous
13 let coordenador: (string, number, bool) = ("Coordenador", 101, true);
14 let nomeCargo = coordenador.0;  // Access by numeric index
15 let nivelPerm = coordenador.1;

Demonstration of annotated variables. In Dryad, the complex tuple type differs from the array type by having a static immutable size with positions accessible via decimal point (.0, .1).

First-Class Functions and Literal Objects
 1 // Function represented as Type
 2 let soma: fn(number, number) -> number = (a, b) => a + b;
 3 
 4 // Literal Objects as Key-Value Dictionaries
 5 let servidor = {
 6   porta: 3000,
 7   host: "127.0.0.1",
 8   ["ativo"]: true
 9 };

Elegant type signatures for closures, higher-order arrow functions, and hash dictionaries.

Found an error in the spec? Open a PR.
Official Version: 1.0 · May 2026