AutolangDocs

Modules

Autolang uses a deterministic, compile-time module system based on the @import(string) directive. Imports declare dependencies explicitly before execution, ensuring the compiler validates all symbols up front.

Standard Library Modules

Built-in standard library components are imported using the std/ prefix. Built-in types such as Array, Map, and Set are part of the core language and do not require any import.

ModuleDescription
std/mathMathematical operations, trigonometry, constants, and random generation.
std/dateDate parsing, formatting, arithmetic, and timestamps.
std/timeHigh-resolution benchmarking, timers, and sleeping.
std/jsonJSON parsing, serialization, and typed DTO decoding.
std/fileBounded file I/O operations and directory traversal.
std/bytesRaw byte buffers, Hex, and Base64 conversions.
std/regexRegular expression matching, searching, and replacing.
std/httpSandboxed synchronous and concurrent HTTP requests.
@import("std/math") @import("std/date") val currentDate = Date.now() println("Today: " + currentDate.toDateString()) println("Square root of 81: " + Math.sqrt(81.0))

Host Capability Modules

The host application registers business capabilities into the compiler (for example, CRM, ERP, or billing bindings). Scripts access them cleanly using standard @import declarations without managing credentials.

// Registered by the host application environment @import("crm") @import("payment") val customers = crm.getSegment("enterprise") payment.authorizeBatch(customers)

Local File Imports

Separate helper routines into modular files. Local imports are resolved relative to the calling script using ./ or ../.

@import("./services/accounting") @import("../common/types") val ledger = AccountingLedger() ledger.sync()

Security Guarantees

The module system strictly enforces security boundaries:

  • Compile-time verification: All imports are checked before any line runs.
  • Zero dynamic evaluation: There is no eval() or dynamic module loading at runtime.
  • String literal requirement: Import paths must be static string literals known at compile time.