Skip to main content

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 Math and import math both 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

LibraryNamespacePurposeStatus
MathMathReal-number arithmetic, trigonometry, logarithms, random numbers, number theory, and special functionsDocumented
cmathcmathComplex-number math (part of the Math library)Documented
FSfsFilesystem operations, path utilities, hashing, watching, and batch/transactional helpersDocumented
PathPathCross-platform path objects: joining, components, normalization, and FS integrationDocumented
ProcessProcessSpawn and control child processes: run, capture, pipeline, timeouts, environment, and process infoDocumented
JSONJSONJSON parsing, serialization, validation, and buildersDocumented
IOIOConsole I/O, in-memory/buffered streams, binary serialization with endianness, pipes, and adaptersDocumented
TimeTimeDurations, instants, dates, naive/UTC/offset/zoned date-times, parsing, formatting, stopwatchesDocumented
RegexRegexRegular expressions: match, find, capture groups, replace, split, and flagsDocumented
EnvEnvEnvironment variables, .env files, directories, platform/system info, and command-line argsDocumented
RandomRandomPRNG, unbiased ints/floats, bytes, strings, UUIDs, sampling, seeded Rng, and distributionsDocumented
CollectionsCollections15 data structures (Vec, maps, sets, heaps, queues, stacks) plus map/filter/reduceDocumented
CryptoCryptoHashing, HMAC/HKDF, Argon2id passwords, AEAD encryption, signatures, key exchange, JWT, and encodingsDocumented
EncodingEncodingText encodings (UTF-8/16/32, ASCII), Base64/Base64URL/hex, percent & form encoding, endian binary serialization, VarInt/LEB128, and BOM handlingDocumented
CompressionCompression7 lossless codecs (Zstd, GZIP, Brotli, LZ4, XZ, DEFLATE, ZLIB), adaptive compression, streaming & seekable archives, ZIP/TAR, parallel & file compression, auto-detection, and checksumsDocumented
NetNetCross-platform networking primitives: TCP client/server, UDP sockets, IP & socket address parsing, interface enumeration, and SSRF policy sandboxingDocumented
URLURLWHATWG URL parsing, protocol/host components, normalization, and URLSearchParams query parameter manipulationDocumented
DNSDNSHigh-performance DNS resolution, record queries (A, AAAA, MX, TXT, NS, CNAME, SOA, SRV, CAA), service discovery, LRU caching, and rebinding policyDocumented
TLSTLSSecure TLS client/server connections, certificate verification, ALPN negotiation, STARTTLS wrapping, and handshake diagnosticsDocumented
WebSocketWebSocketRFC 6455 WebSocket client/server, handshake, frame handling, binary/text messages, TLS wss, broadcast/roomsDocumented
HTTPhttpHTTP client requests, response handling, headers, middlewareDocumented
Concurrencyparallel_*Parallel helpers, channels, Mutex/RwLock, worker pools, atomicsDocumented
SIMDSimdHardware SIMD vectors — vec4<f32>, f32x4 aliases, Simd.* reductions, auto-vectorization, fused opsDocumented
ATPAtpAdesh Transport Protocol — Ed25519 identity, 19 frame types, fragmentation, congestion control, game-state syncDocumented
printglobalRich console output, styling, and pretty-printDocumented
Input & TUIinput.*18+ Interactive terminal widgets: prompts, selectors, datepicker, datetime, visual diff, table with sub-properties, PIN/OTP pad, slider, color, hotkey, and test mocksDocumented

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 Math and cmath namespaces.
  • FS Library — complete reference for the fs, fs.path, fs.async, fs.tx, fs.snapshot, fs.batch, and fs.fsql namespaces.
  • Path Library — complete reference for the Path class, components, and builder.
  • Process Library — complete reference for the Process, ProcessBuilder, and ChildProcess namespaces.
  • JSON Library — complete reference for the JSON namespace.
  • IO Library — complete reference for the IO stream classes and combinators.
  • Time Library — complete reference for the Time date/time classes, parsing, and formatting.
  • Regex Library — complete reference for the Regex namespace, Match, and Captures.
  • Env Library — complete reference for the Env namespace: environment variables, directories, platform info, and command-line args.
  • Random Library — complete reference for the Random namespace, seeded Rng, and distributions.
  • Collections Library — complete reference for the 15 Collections data structures and map/filter/reduce.
  • Crypto Library — complete reference for the Crypto namespace: hashing, MACs, KDFs, passwords, AEAD, signatures, JWT, and encodings.
  • Encoding Library — complete reference for the Encoding namespace: text encodings, Base64/Base64URL/hex, percent & form encoding, endian binary serialization, VarInt/LEB128, and BOM handling.
  • Compression Library — complete reference for the Compression namespace: codecs, adaptive compression, streaming & seekable archives, ZIP/TAR, parallel & file compression, auto-detection, and checksums.
  • Net Library — complete reference for the Net namespace: TCP client/server, UDP datagrams, IP/socket addresses, interface enumeration, and SSRF sandboxing.
  • URL Library — complete reference for the URL namespace: WHATWG URL parsing and URLSearchParams manipulation.
  • DNS Library — complete reference for the DNS namespace: 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 Simd vectors, 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).