Standard Libraries
AdeshLang ships a set of builtin libraries — namespaces that are compiled directly into the runtime and available in every program without downloading anything. They provide high-performance, ready-to-use functionality for numeric math, complex numbers, random numbers, file access, JSON, HTTP, concurrency, and more.
Unlike modules you write yourself or pull from a package registry, builtin libraries:
- Are always available — no external files, manifests, or network access required.
- Are case-insensitive to import and resolve to the registered namespace (
import Mathandimport mathboth work). - Are implemented natively (in Rust) for speed, with the same behavior across every backend (Interpreter, Bytecode VM, JIT, Native JIT, AOT, WebAssembly, GPU/MLIR).
How to use a builtin library
Builtin libraries are used through the import statement. The import binds the library's namespace under a name you can call methods on.
import Math; // real-number math
import cmath; // complex-number math
print(Math.sqrt(16.0)); // 4.0
print(cmath.sqrt(-4.0)); // 0.0 + 2.0j
You can also import individual members:
import { sqrt, pow } from "Math";
print(sqrt(25.0)); // 5.0
tip
Every builtin library follows the same mental model: import the namespace, then call Namespace.method(...). Constants are exposed as namespace properties such as Math.PI.
Available builtin libraries
| Library | Namespace | Purpose | Status |
|---|---|---|---|
| Math | Math | Real-number arithmetic, trigonometry, logarithms, random numbers, number theory, and special functions | Documented |
cmath | cmath | Complex-number math (part of the Math library) | Documented |
| FS | fs | Filesystem operations, path utilities, hashing, watching, and batch/transactional helpers | Documented |
| Path | Path | Cross-platform path objects: joining, components, normalization, and FS integration | Documented |
| Process | Process | Spawn and control child processes: run, capture, pipeline, timeouts, environment, and process info | Documented |
| JSON | JSON | JSON parsing, serialization, validation, and builders | Documented |
| IO | IO | Console I/O, in-memory/buffered streams, binary serialization with endianness, pipes, and adapters | Documented |
| Time | Time | Durations, instants, dates, naive/UTC/offset/zoned date-times, parsing, formatting, stopwatches | Documented |
| Regex | Regex | Regular expressions: match, find, capture groups, replace, split, and flags | Documented |
| Env | Env | Environment variables, .env files, directories, platform/system info, and command-line args | Documented |
| Random | Random | PRNG, unbiased ints/floats, bytes, strings, UUIDs, sampling, seeded Rng, and distributions | Documented |
| Collections | Collections | 15 data structures (Vec, maps, sets, heaps, queues, stacks) plus map/filter/reduce | Documented |
| Crypto | Crypto | Hashing, HMAC/HKDF, Argon2id passwords, AEAD encryption, signatures, key exchange, JWT, and encodings | Documented |
| Encoding | Encoding | Text encodings (UTF-8/16/32, ASCII), Base64/Base64URL/hex, percent & form encoding, endian binary serialization, VarInt/LEB128, and BOM handling | Documented |
| Compression | Compression | 7 lossless codecs (Zstd, GZIP, Brotli, LZ4, XZ, DEFLATE, ZLIB), adaptive compression, streaming & seekable archives, ZIP/TAR, parallel & file compression, auto-detection, and checksums | Documented |
| Net | Net | Cross-platform networking primitives: TCP client/server, UDP sockets, IP & socket address parsing, interface enumeration, and SSRF policy sandboxing | Documented |
| URL | URL | WHATWG URL parsing, protocol/host components, normalization, and URLSearchParams query parameter manipulation | Documented |
| DNS | DNS | High-performance DNS resolution, record queries (A, AAAA, MX, TXT, NS, CNAME, SOA, SRV, CAA), service discovery, LRU caching, and rebinding policy | Documented |
| TLS | TLS | Secure TLS client/server connections, certificate verification, ALPN negotiation, STARTTLS wrapping, and handshake diagnostics | Documented |
| WebSocket | WebSocket | RFC 6455 WebSocket client/server, handshake, frame handling, binary/text messages, TLS wss, broadcast/rooms | Documented |
| HTTP | http | HTTP client requests, response handling, headers, middleware | Documented |
| Concurrency | parallel_* | Parallel helpers, channels, Mutex/RwLock, worker pools, atomics | Documented |
| SIMD | Simd | Hardware SIMD vectors — vec4<f32>, f32x4 aliases, Simd.* reductions, auto-vectorization, fused ops | Documented |
| ATP | Atp | Adesh Transport Protocol — Ed25519 identity, 19 frame types, fragmentation, congestion control, game-state sync | Documented |
print | global | Rich console output, styling, and pretty-print | Documented |
| Input & TUI | input.* | 18+ Interactive terminal widgets: prompts, selectors, datepicker, datetime, visual diff, table with sub-properties, PIN/OTP pad, slider, color, hotkey, and test mocks | Documented |
Library reference pages
- Input & TUI Library — complete reference for
input,input.table,input.datepicker,input.datetime,input.diff,input.pin, and all 18 interactive widgets. - Math Library — complete reference for the
Mathandcmathnamespaces. - FS Library — complete reference for the
fs,fs.path,fs.async,fs.tx,fs.snapshot,fs.batch, andfs.fsqlnamespaces. - Path Library — complete reference for the
Pathclass, components, and builder. - Process Library — complete reference for the
Process,ProcessBuilder, andChildProcessnamespaces. - JSON Library — complete reference for the
JSONnamespace. - IO Library — complete reference for the
IOstream classes and combinators. - Time Library — complete reference for the
Timedate/time classes, parsing, and formatting. - Regex Library — complete reference for the
Regexnamespace,Match, andCaptures. - Env Library — complete reference for the
Envnamespace: environment variables, directories, platform info, and command-line args. - Random Library — complete reference for the
Randomnamespace, seededRng, and distributions. - Collections Library — complete reference for the 15
Collectionsdata structures andmap/filter/reduce. - Crypto Library — complete reference for the
Cryptonamespace: hashing, MACs, KDFs, passwords, AEAD, signatures, JWT, and encodings. - Encoding Library — complete reference for the
Encodingnamespace: text encodings, Base64/Base64URL/hex, percent & form encoding, endian binary serialization, VarInt/LEB128, and BOM handling. - Compression Library — complete reference for the
Compressionnamespace: codecs, adaptive compression, streaming & seekable archives, ZIP/TAR, parallel & file compression, auto-detection, and checksums. - Net Library — complete reference for the
Netnamespace: TCP client/server, UDP datagrams, IP/socket addresses, interface enumeration, and SSRF sandboxing. - URL Library — complete reference for the
URLnamespace: WHATWG URL parsing and URLSearchParams manipulation. - DNS Library — complete reference for the
DNSnamespace: hostname resolution, record queries (A, AAAA, MX, TXT, NS, CNAME, SOA, SRV, CAA), service discovery, LRU caching, and security policies. - TLS Library — complete reference for secure TLS clients, server listeners, STARTTLS wrapping, certificate verification, ALPN negotiation, and handshake tracing.
- WebSocket Library — complete reference for RFC 6455 clients/servers, frame types, close codes, TLS, broadcast/rooms.
- SIMD Library — complete reference for
Simdvectors, lane ops, auto-vectorization, and fused pipelines. - ATP Library — complete reference for Adesh Transport Protocol — identity, streams, frames, reliability, game-state sync.
- Concurrency Library — complete reference for scheduler, channels, Mutex/RwLock, Barrier, atomics.
- URL Library — complete reference for WHATWG URL and URLSearchParams (supplement to Net/DNS/TLS).
Related
- Standard Library Overview — the full list of global built-in functions.
- Built-in Functions — quick reference for global functions and namespaces.