API Reference
Untyped escape hatch. Nothing on an Any is resolved statically, so
cast before use with v as Int or v as String.
Dense growable sequence with Int indexes.
Methods, all compiler builtins needing no import:
length(): Int, len(): Int, isEmpty(): Bool, push(item),
pop(), map(closure), filter(closure). length and len also
read as properties. map builds a new array from the closure's return
value; filter keeps the elements the closure accepts and keeps their
original type.
pop() takes the last element and gives null on an empty array.
Reading an index past the end throws index out of bounds, so check
the length first.
Search and fold helpers (find, findIndex, some, every,
reduce, join, reversed) are extension methods below.
Foundation boolean type: true or false.
Methods: toString(): String, which prints true or false.
Single scalar view into a String. The checker treats a Char as a
String, and charCodeAt is how you read the scalar value.
Error value. Catalog stub: throw raises a String message and
catch (e) binds it, so an Error carries nothing on its own.
Relaxed float type.
Produced by Float.asFast() and read back with asStrict(). It mixes
with Float only after an explicit conversion, and comparing one with
the other needs 82.5.asFast()-style literals.
Foundation float type: an IEEE-754 double.
Methods: toString(): String, toBits(): Int, asFast(): FastFloat,
asStrict(): Float. Statics: Float.nan(), Float.isNaN(x),
Float.fma(a, b, c), Float.fromBits(bits).
A Float and a FastFloat never mix in one expression; the mix is
E305, so name the conversion you mean.
Generational reference for cyclic edges. GenRef.of(x) takes a
reference without raising the owner's retain count, and .get() gives
null once the owner is gone, so a back edge never keeps a graph
alive. ARC owns, GenRef points back; use #[Allow(CyclicReference)]
on a field for a strong cycle you mean to break yourself.
Insertion-ordered key-value table. Catalog stub: Map and its
methods live in @std/collections.
Distinct-member collection. Catalog stub: Set and its methods live
in @std/collections.
Canonical UTF-8 string type.
Every index counts characters, not bytes, so a multi-byte character is one step like any other.
Methods, all compiler builtins needing no import:
length(): Int, len(): Int, slice(start: Int, end: Int): String,
indexOf(needle: String): Int, indexOf(needle: String, from: Int): Int,
trim(): String, concat(other: String): String,
charCodeAt(index: Int): Int. length and len also read as
properties.
slice clamps both bounds to the length and gives "" once the start
reaches the end. Both indexOf forms give the index of the first match
at or after their start, or -1 when there is none; an empty needle
answers with the start it was given. trim strips leading and trailing
whitespace. charCodeAt gives the Unicode code point of the character
at that index, or -1 past the end.
Search and transform helpers (contains, startsWith, endsWith,
split, replace, replaceAll, repeat, toUpperCase,
toLowerCase) are extension methods below.
Absence of a return value. Void marks a function that only has
effects; null is the absent value itself, of type Null.
- Err(E)
- Ok(T)