Standard Library
Why This Matters
This page maps common runtime capabilities to the right module and import. If a stdlib call unexpectedly fails, this is the first place to check.
Module Map
- I/O + File
- Math
- Strings (
Str) - Time
- System
- Args
- Collections
std.netnamespace (import-valid placeholder; runtimeNet.*API not exposed yet)
std.net (Current State)
You can import this namespace today:
import std.net.*;
But current stdlib does not expose runtime Net.* member functions yet.
What this means:
- import path is valid (so project/module structure can be prepared now)
- do not expect callable runtime network helpers from stdlib yet
- effect contracts like
@Netare still enforced by the type checker
Import Rules (Important)
Arden stdlib is compiler-intrinsic, but module usage still requires explicit imports:
- console I/O:
import std.io.*; - file API (
File.*):import std.fs.*; - math (
Math.*):import std.math.*; - strings (
Str.*):import std.string.*; - time (
Time.*):import std.time.*; - system (
System.*):import std.system.*; - args (
Args.*):import std.args.*; - net namespace placeholder:
import std.net.*;(no runtimeNet.*members yet)
Builtins Available Without Import
- conversions:
to_string,to_int,to_float - ranges:
range - process exit:
exit - assertions:
assert,assert_eq,assert_ne,assert_true,assert_false - panic helper:
fail()orfail("message") - option/result constructors:
Option.some,Option.none,Result.ok,Result.error
Assertion quick reference:
assert(condition: Boolean)assert_true(condition: Boolean)assert_false(condition: Boolean)assert_eq(left: T, right: T)(compatible types)assert_ne(left: T, right: T)(compatible types)
Option/Result quick reference:
Option.some(value)/Option.none()Result.ok(value)/Result.error(errorValue)
Also valid, but less explicit:
Option<T>()->NoneResult<T, E>()->Error(default(E))
Function Values
You can store builtin and stdlib members as typed function values:
import std.args.*;
import std.math.*;
import std.system.*;
function main(): None {
conv: (Integer) -> Float = to_float;
cwd: () -> String = System.cwd;
argc: () -> Integer = Args.count;
rand: () -> Float = Math.random;
_f: Float = conv(7);
_cwd: String = cwd();
_argc: Integer = argc();
_r: Float = rand();
return None;
}
Quick Decision Guide
- logging/user text output ->
std.io - file read/write/delete/exists ->
std.fs - numeric operations/constants/random ->
std.math - string transforms/search/compare ->
std.string - OS/env/shell/cwd/exit code behavior ->
std.system - command-line arg parsing ->
std.args - time formatting/sleep/unix timestamp ->
std.time
Common Mistakes
- assuming module symbols are globally available without import
- mixing
System.shell(exit code) andSystem.exec(stdout text) - calling
Args.get(i)without checkingArgs.count()first (Args.getreturnsString; out-of-range index is runtime error) - treating
Str.compare(a, b)as boolean instead of integer relation (<0,0,>0)