Standard Library
The AutoLang Standard Library provides a set of highly optimized core functionalities. Most of these are auto-imported, meaning they are available globally without any @import statement. Specialized modules require explicit importing.
๐ก Empty Core Types & Extension Modules
To keep the runtime core tiny and modular, classes like Json and Bytes are defined globally as empty classes (making them valid types anywhere). To access their helper methods (e.g., Json.parse()), you must explicitly import their module using @import, which loads the corresponding extension functions.
Core (Auto-Imported)
These types, functions, and data structures are available in every file by default. You do not need to import anything to use them.
Primitive Types
Basic types used for fundamental operations. They are marked with @no_extends and cannot be inherited.
Int64-bit signed integer. Methods: toString()
Float64-bit floating point number. Methods: toString()
BoolBoolean value (true/false).
Void / Null / AnySpecial types for VM type-safety.
Core Data Structures
AutoLang provides native, memory-contiguous collections and text manipulation classes for high-performance operations.
Global Functions
Utilities available globally for debugging and I/O.
| Function | Description |
|---|---|
| print(val: Any?) | Prints value without a newline. |
| println(val: Any?) | Prints value with a newline. |
| assert(cond, file, line) | Throws an Exception if the condition is false. |
| getRefCount(val) | Debug tool: Returns current reference count of a heap object. |
Modules (Import Required)
These modules must be explicitly imported using @import("path/to/module") at the top of your file.
File System (std/file)
Read Guide โProvides everything you need to read, write, and manage files and directories.
@import("std/file")
if (File.exists("config.txt")) {
val file = File("config.txt", FileMode.READ)
println(file.readText())
file.close()
}Date & Time (std/date)
Read Guide โComprehensive tools for working with dates, times, timestamps, and formatting.
@import("std/date")
val now = Date.now()
println("Current time: ${now.format("%Y-%m-%d %H:%M:%S")}")Math (std/math)
Read Guide โProvides mathematical operations, trigonometry, and random number generation.
@import("std/math")
println("Random Int: ${Math.random(1, 100)}")
println("Pow(2, 3): ${Math.pow(2.0, 3.0)}")Performance Time (std/time)
Provides utilities for interacting with system time to measure execution performance.
@import("std/time")
val start = Time.now()
// ... do some heavy work ...
val end = Time.now()
println("Execution took: ${end - start} ms")