Aura’s core stdlib is intentionally small (RFC-007, RFC-000 batteries-included-but-modular). In this repository, packages live under std/.
Packages today (post-alpha C12)
| Package | Path | Role |
|---|---|---|
std.io | std/io | Console, file I/O, argv, stdin, exit |
std.assert | std/assert | Assert helpers for tests |
std.collections | std/collections | Map/Set/HashMap/HashMapStr, Iterable, Int·String HOF, join (C12j) |
Builtins such as Array<T> and core scalars are part of the language, not a separate import. String methods (indexOf, split, trim, toInt, …) are language surface — see Types and the cheatsheet.
std.io
Console, process, and file helpers (runtime aura_* intrinsics). Strict file APIs throw a String message on failure (missing path, I/O error, oversized file, embedded NUL). Soft tryReadFile returns null instead. Text is treated as a regular-file UTF-8 byte sequence (no embedded NUL); max size 256 MiB.
Console
| API | Role |
|---|---|
print / println | stdout (no newline / with newline) |
eprint / eprintln | stderr |
Process (C12b–e)
| API | Role |
|---|---|
args(): Array<String> | Process argv; [0] = program name; user flags from index 1 (C12b) |
readLine(): String? | One line without trailing \n / \r\n; null on EOF; empty line is "" (C12d) |
readAllStdin(): String | Remainder of stdin (throws on oversize / I/O / embedded NUL) |
exit(code: Int) | Terminate with status; flushes stdout/stderr first; does not return (C12e) |
Pass user args after -- with the CLI (CLI):
aura run my_pkg -- --flag value
cargo run -p aura-cli -- run corpus/std_io/args -- hello
printf 'line\n' | cargo run -p aura-cli -- run corpus/std_io/stdinFiles (C11a / C12p)
| API | Role |
|---|---|
readFile(path): String | read entire regular file (throws on error) |
tryReadFile(path): String? | soft read; null on missing/error (C12p) |
writeFile(path, content) | create/truncate and write |
appendFile(path, content) | append (create if needed) |
fileExists(path): Bool | regular file present |
fileSize(path): Int | byte size (throws if missing) |
Typical use (explicit import or auto-prelude on package builds):
package main
import std.io as Io
fun main() {
Io.println("Hello, Aura")
val argv = Io.args()
if (argv.len > 1) {
Io.println(argv.get(1))
}
Io.writeFile("out.txt", "hi")
val s = Io.tryReadFile("out.txt")
if (s != null) {
Io.println(s)
}
}Corpus:
aura run corpus/std_io/app
aura run corpus/std_io/prelude
aura run corpus/std_io/files
aura run corpus/std_io/try_read_file
aura run corpus/std_io/args -- hello
aura run corpus/std_io/stdin
aura run corpus/std_io/exit
# monorepo: cargo run -p aura-cli -- run corpus/std_io/filesDogfood CLI that ties args + soft read + String tools: examples/wc (README).
std.assert
Use with aura test and @test functions:
aura run corpus/std_assert/appPrefer package tests that exercise assert / assert_eq for Int / String / Bool in the current MVP.
std.collections
| Type / helper | Notes |
|---|---|
Map<K, V> | Linear map; get → V?; put / remove / clear |
Set<T> | Generic set (linear) |
HashMap | String→Int open addressing + auto-resize (C8i/C9b) |
HashMapStr | String→String open addressing; hash_map_str() (C12n) |
Iterable<E> | len + get protocol for for-in |
map_ints / filter_ints / fold_ints | Int array HOF helpers |
map_strings / filter_strings / fold_strings | String array HOF helpers (C12o) |
join(parts, sep) | Array<String> → String with separator (C12j) |
Alpha limits: no generic HashMap<K,V> yet (concrete monos: String→Int, String→String). See Arrays for HOF usage and capture limits.
aura run corpus/std_collections/app
aura run corpus/std_collections/hashmap
aura run corpus/std_collections/hashmap_str
aura run corpus/std_collections/hof
aura run corpus/std_collections/hof_str
aura run corpus/std_collections/joinHow the CLI finds std.*
- Auto-prelude
std.iofor package builds - Path resolution for
std.*(io / assert / collections):AURA_STD(directory that containsio/,assert/, …)- Walk-up from the package looking for monorepo
std/<pkg> - Release install:
share/aura/std/<pkg>next to the toolchain - Embedded copy materialized under
~/.cache/aura/<version>/std/
After a normal install (or cargo install of a recent CLI), you should not need to declare std.io = { path = "..." } in app aura.toml.
What is not in core (by design)
Application frameworks, DI containers, ORM/HTTP stacks stay out of core RFCs. Expect those as ecosystem packages later, not as stdlib defaults.