Overview
implicit scope
Symbols in @std/prelude are available in every Rasmalai
source file out-of-the-box without an explicit import. Explicit imports are supported for
disambiguation.
Names every compilation unit sees without an import.
An explicit declaration or an import always shadows a prelude name. The
class stubs below are catalog-only: the frontend parses them once per
session as a fallback scope and emits no code for them. Three items are
real, though. Result is a generic enum merged into every program as
std.prelude.Result, Promise and ArrayIter carry their bodies here,
and the Array and String extensions below are compiled into every
program too. Map and Set are stubs; their bodies live in
@std/collections.
Ambient functions need no import either: print, assert, typeOf,
IO, Thread, ThreadPool, Pointer, and Address.
An absent value is null, of type Null. Searches and lookups return
null when nothing matches, and ?? substitutes a fallback. Query
methods such as isOk lower to a discriminant check on the variant tag,
and emit nothing until they are called.
let xs: Array<Int> = [];
print(xs.find((x: Int): Bool => x > 0) ?? -1);When to use it
The prelude is already imported everywhere: every file sees Option, Result, Array, Map, print, assert, and the Array/String extension methods with no import. Reference @std/prelude explicitly only to disambiguate a shadowed name.
Capabilities
- Int/Float/Bool/String/Array/Map/Set
- print/assert/typeOf intrinsics
- Option/Result/Iterator
- Array/String extensions
Symbols
- class Any — Untyped escape hatch. Nothing on an
Anyis resolved statically, so - class Array — Dense growable sequence with
Intindexes. - class ArrayIter — Index-based iterator over an array. It holds the array and a cursor,
- class Bool — Foundation boolean type:
trueorfalse. - class Char — Single scalar view into a
String. The checker treats aCharas a - class Date — Calendar view over the wall clock. Catalog stub:
@std/timeowns the - class Error — Error value. Catalog stub:
throwraises aStringmessage and - class FastFloat — Relaxed float type.
- class Float — Foundation float type: an IEEE-754 double.
- class GenRef — Generational reference for cyclic edges.
GenRef.of(x)takes a - class Int — Foundation integer type: a signed 64-bit whole number.
- class Map — Insertion-ordered key-value table. Catalog stub:
Mapand its - class Promise — One-shot eventual value:
Pending(0),Fulfilled(1),Rejected(2). - class PromiseResult — Settlement record for
Promise.allSettled. One per input promise, - class PromiseWithResolvers — Manual settlement handles from
Promise.withResolvers. It holds the - class RnxHost — Host metadata:
rnxis ambient in every module with no import. - class Set — Distinct-member collection. Catalog stub:
Setand its methods live - class String — Canonical UTF-8 string type.
- class Void — Absence of a return value.
Voidmarks a function that only has - enum Result