radlang — Built-in hover reference

string.lines() splits on newlines and preserves a trailing empty element: "a\nb\n".lines() yields ["a", "b", ""].

T[].slice(long start, long end) returns a new list with an exclusive end. Bounds follow string.slice: negative starts clamp to zero, bounds above the length clamp to the length, and end <= start returns an empty list. Elements are shallow copies; the returned list has independent backing storage.

This page mirrors the signatures supplied by the compiler’s LSP catalog (src/builtin_catalog.rs and src/builtin_methods.rs). Namespace guides contain the longer explanations; this page is the compact signature reference.

See reserved identifiers for namespace names that cannot be reused for local variables or parameters.

Namespaces

fn sys.output(?any value): void
fn sys.output.write(any value): void
fn sys.output.flush(): void
fn sys.output.clear(): void
fn sys.output.clearLine(): void
fn sys.write(any value): void          // like sys.output.write: no newline
fn sys.print(any value): void          // like sys.output.write: no newline
fn sys.input(?string prompt): string
fn sys.exit(int status): void
fn sys.env(string name, ?string value): string
fn sys.error(?string message): void
fn sys.sleep(int ms): void
fn sys.args(): string[]
fn sys.cwd(): string
fn sys.executable(): string
fn sys.pid(): int
fn sys.platform(): string
fn sys.arch(): string
fn sys.hostname(): string
fn sys.sleepAsync(int ms): Future<void>
fn sys.cli(string cmd): Future<int>
fn sys.cores(): int
fn sys.spawn(string exe, string[] args): Future<int>
fn sys.exec(string exe, string[] args): Future<ProcOutput>
fn sys.start(string exe, string[] args): Process
fn sys.memory(): MemoryStats
fn sys.collect(): void                 // collect until what is unreachable has been freed
fn sys.secureSet(string service, string key, string value): bool
fn sys.secureGet(string service, string key): string?
fn sys.secureDelete(string service, string key): bool
fn sys.secureKeys(string service): string[]
fn sys.clipboardSet(string text): bool
fn sys.clipboardGet(): string
fn sys.openUrl(string url): bool
fn sys.browse(string url, fn(): void onClose): bool
fn sys.shareText(string text, ?string subject): bool
fn sys.shareFile(string path, string mime, ?string title): bool
fn sys.haptic(string kind): bool
fn sys.worker(fn(WorkerPort): void body): Worker
fn sys.isWorker(): bool
fn sys.service(string op, ?string argsJson): string
fn sys.onService(fn(string): void onEvent): void
fn sys.home(): string
fn sys.tmp(): string
fn sys.blockOn(Future<T> future): T

fn cfg.env(string key): string
string cfg.name; string cfg.version; string cfg.profile
string cfg.buildDir; string cfg.srcDir; string cfg.staticDir
string cfg.libDir; string cfg.testsDir; string cfg.namespaceDir
string cfg.icon                        // project.icon from config.yaml

fn math.random(): num
fn math.random(int min, int max): int  // inclusive
fn math.seed(int s): void
fn math.sqrt(num x): num
fn math.abs(num x): num
fn math.floor(num x): num
fn math.ceil(num x): num
fn math.round(num x): num
fn math.log(num x): num
fn math.log2(num x): num
fn math.log10(num x): num
fn math.sin(num x): num
fn math.cos(num x): num
fn math.tan(num x): num
fn math.tanh(num x): num
fn math.exp(num x): num
fn math.pow(num base, num exp): num
fn math.min(num a, num b): num
fn math.max(num a, num b): num
fn math.clamp(num x, num lo, num hi): num
float math.PI; float math.E; float math.TAU
fn math.sort.radix(numeric[] values[, int threadCount]): numeric[]
fn math.sort.count(numeric[] values): numeric[]
fn math.sort.timsort(numeric[] values): numeric[]
fn math.sort.intro(numeric[] values): numeric[]
fn math.sort.pdq(numeric[] values): numeric[]

fn json.parse<T>(string body[, limits]): T   // limits: see json.md
fn json.from(any value): string
fn json.fromExact(any value): string   // floats in shortest round-trip form
fn json.valid(string body): bool

fn xml.parse(string body): XmlNode
fn xml.from(any value): XmlNode
fn xml.string(XmlNode node): string
fn xml.tag(XmlNode node): string
fn xml.text(XmlNode node): string
fn xml.attr(XmlNode node, string key): string
fn xml.hasAttr(XmlNode node, string key): bool
fn xml.attrs(XmlNode node): string[]
fn xml.isNull(XmlNode node): bool
fn xml.child(XmlNode node, int index): XmlNode
fn xml.childCount(XmlNode node): int
fn xml.children(XmlNode node): XmlNode[]
fn xml.find(XmlNode node, string tag): XmlNode
fn xml.findAll(XmlNode node, string tag): XmlNode[]

fn regex.from(string pattern, string flags?): RegEx
fn native.open(string path): NativeLib
// NativeLib.call(string symbol, string input): string
// NativeLib.callAsync(string symbol, string input): Future<string>

fn fs.readText(string path): Future<string?>
fn fs.readTextSync(string path): string?
fn fs.readBytes(string path): Future<byte[]>
fn fs.readBytesSync(string path): byte[]
fn fs.mapBytesSync(string path): byte[]
fn fs.readBytesAtSync(string path, long offset, long count): byte[]
fn fs.stat(string path): FileInfo
fn fs.exists(string path): bool
fn fs.basename(string path): string
fn fs.dirname(string path): string
fn fs.extension(string path): string
fn fs.resolve(string path): string
fn fs.listDir(string path): string[]
fn fs.listDirFull(string path): string[]
fn fs.mkdir(string path): bool
fn fs.delete(string path): Future<bool>
fn fs.deleteSync(string path): bool
fn fs.writeText(string path, string content): Future<bool>
fn fs.writeTextSync(string path, string content): bool
fn fs.writeBytes(string path, byte[] data): Future<bool>
fn fs.writeBytesSync(string path, byte[] data): bool
fn fs.appendText(string path, string content): Future<bool>
fn fs.appendTextSync(string path, string content): bool
fn fs.appendBytes(string path, byte[] data): Future<bool>
fn fs.appendBytesSync(string path, byte[] data): bool
fn fs.rename(string from, string to): Future<bool>
fn fs.renameSync(string from, string to): bool
fn fs.copy(string from, string to): Future<bool>
fn fs.copySync(string from, string to): bool
fn fs.tempFile(): Future<string>
fn fs.tempFileSync(): string
fn fs.tempDir(): Future<string>
fn fs.tempDirSync(): string
fn fs.walk(string path): Future<string[]>
fn fs.walkSync(string path): string[]
fn fs.readDirInfo(string path): Future<DirEntry[]>
fn fs.readDirInfoSync(string path): DirEntry[]
fn fs.watch(string path, fn(string): void callback): void
fn fs.join(string a, string b): string

fn hash.md5(string input): string
fn hash.sha1(string input): string
fn hash.sha256(string input): string
fn hash.sha256Bytes(byte[] input): string
fn hash.sha512(string input): string
fn crypto.hmacSha256(string key, string input): string
fn crypto.base64Encode(string input): string
fn crypto.base64Decode(string input): string
fn crypto.randomBytes(int n): string
fn crypto.aesEncrypt(string key, string plaintext): string
fn crypto.aesDecrypt(string key, string ciphertext): string
fn crypto.hashPassword(string password, int cost?): string
fn crypto.verifyPassword(string password, string hash): bool

fn compress.gzip(string|byte[] input, map meta?): byte[]
fn compress.gunzip(byte[] data): string | byte[]
fn compress.deflate(string|byte[] input): byte[]
fn compress.inflate(byte[] data): string | byte[]
fn compress.gzipInfo(byte[] data): string
fn compress.unzip(string|byte[] src, string destDir): int
fn compress.unzip(string|byte[] src, string destDir, long maxEntries, long maxExpandedBytes): int
fn compress.zip(string destPath, string[] files): int
fn compress.zipEntries(string|byte[] src): string[]
fn compress.zipRead(string|byte[] src, string name, long maxBytes?): byte[]
fn compress.zipBytes(string[] names, byte[][] contents): byte[]

fn http.get(string url): Future<HttpResponse>
fn http.getSync(string url): HttpResponse
fn http.delete(string url): Future<HttpResponse>
fn http.deleteSync(string url): HttpResponse
fn http.post(string url, string body, string contentType): Future<HttpResponse>
fn http.postSync(string url, string body, string contentType): HttpResponse
fn http.put(string url, string body, string contentType): Future<HttpResponse>
fn http.putSync(string url, string body, string contentType): HttpResponse
fn http.patch(string url, string body, string contentType): Future<HttpResponse>
fn http.patchSync(string url, string body, string contentType): HttpResponse
fn http.request(string method, string url, string[] headers, string body): Future<HttpResponse>
fn http.requestSync(string method, string url, string[] headers, string body): HttpResponse
fn http.encode(string s): string
fn http.decode(string s): string
fn http.retry(int count, int backoffMs = 200): void
fn http.circuitBreaker(int threshold, int cooldownMs): void
fn http.proxy(string url): void
fn httpserver.serve(int port): HttpServer
fn httpserver.serve(int port, string bindAddress): HttpServer
fn db.connect(string url): Database
fn db.eq(string column, any value): string
fn db.like(string column, any value): string
fn db.and(string left, string right): string
fn db.or(string left, string right): string
fn db.not(string condition): string
fn db.asc({ columns }): string
fn db.desc({ columns }): string

fn tcp.listen(int port): TcpServer
fn tcp.connect(string host, int port, int timeoutMs?): TcpConn
fn websocket.connect(string url): WebSocket
fn sse.connect(string url): SseClient
fn gui.window(string title, int width, int height, {flags}?): Window
fn gui.run(Window window): void
fn syn.window(string title, int w, int h, {flags}?): NativeWindow
fn syn.webview(string title, int w, int h): Window
fn syn.run(NativeWindow win): void
fn syn.px(num n): num
fn syn.pct(num n): num
fn syn.rgb(int r, int g, int b): int
fn syn.every(int ms, fn callback): int
fn syn.after(int ms, fn callback): int
fn syn.cancel(int timerId): void
fn syn.post(fn work): void
fn syn.panel / label / button / input / textarea / number / checkbox / select / grid / split / divider / spacer / progress / slider / toggle / radio / tabs / image(...): SynNode   // detached builders for `children: [...]`

Value methods

TcpConn: read(), readTimeout(int timeoutMs), write(string data), writeTimeout(string data, int timeoutMs), startTls(string serverName, string caPath[, int timeoutMs]), acceptTls(string certPath, string keyPath), close(), isOpen()
string: length(), upper(), lower(), trim(), trimStart(), trimEnd(), repeat(int count), contains(string needle), replace(string from, string to[, int count]), split(string separator[, int limit]), startsWith(string prefix), endsWith(string suffix), indexOf(string needle[, int from]), lastIndexOf(string needle), count(string needle), charAt(int index), slice(int start[, int end]), substring(int start[, int length]), padStart(int targetLength, string padString), padEnd(int targetLength, string padString), reverse(), capitalize(), isEmpty(), chars(), utf16Length(), lines(), toInt(), toLong(), toFloat(), toBytes(), toString()
list: length(), length64(), contains(any value), indexOf(any value), add(any value), remove(T value), removeAt(long index), pop(), clear(), combine(list other), join(string separator), map(fn transform[, int threadCount]), where(fn predicate[, int threadCount]), iter(fn each[, int threadCount]), parallel(fn transform[, int threadCount]), reduce(fn combine, any seed[, int threadCount]), first(), last(), reverse(), sort([bool desc | fn comparator | { inPlace: bool, threads: int }]), sortBy(fn key[, bool desc]), sum(), unique(), take(int count), skip(int count), chunk(int size), flatMap(fn transform), groupBy(fn key)
numeric: abs(), round([int digits]), floor([int digits]), ceil([int digits]), min(), max(), toInt(), toLong(), toFloat(), toDec(), toByte(), toBytes(), toString(), toFixed(int digits), toShortest(), toShortestF32(), toHex([int width = 0, bool prefix = false]) (see number-formatting.md)

`upper()` and `lower()` apply Unicode simple case mapping (no locale rules) to
ASCII, Latin-1 Supplement, Latin Extended-A, Greek and Cyrillic letters
(`"ÄÖÜ Σ Ж".lower()` is `"äöü σ ж"`), keeping every other character byte for
byte. A final sigma is not context-sensitive (`Σ` lowers to `σ`), `ß` is
unchanged, and the byte length never grows.

`toInt()` and `toLong()` on a float, decimal or num truncate toward zero and
saturate: a value beyond the target's range clamps to `int`/`long` min or max
(`3000000000.7.toInt()` is `2147483647`, its `toLong()` is `3000000000`) and NaN
becomes 0, the same on every platform. Use `toLong()` for values past 2^31-1.
`string.toInt()` and `string.toLong()` parse a leading base-10 integer (`"3.9"`
is 3, text with no digits is 0; `toLong` is not narrowed to 32 bits, and values
past the long range clamp).
Date: getTime(), getFullYear(), getMonth(), getDate(), getDay(), getHours(), getMinutes(), getSeconds(), getUTCFullYear(), getUTCMonth(), getUTCDate(), getUTCDay(), getUTCHours(), getUTCMinutes(), getUTCSeconds(), toISOString(), toLocaleDateString(), format(string template), diff(Date other): long (ms), addMs(long ms), addSeconds(int n), addMinutes(int n), addHours(int n), addDays(int n), addMonths(int n), addYears(int n) (each returns a new Date)
Future: resolve(fn callback), timeout(int ms), cancel()
fn Future.all(Future<T>[] futures): Future<T[]>
fn Future.race(Future<T>[] futures): Future<T>
any value: pipe(fn(T): R transform): R — calls transform(value); not offered on a Future; see Piping values in the language guide
RegEx: isMatch(string text), find(string text), match(string text), findAll(string text), split(string text), replace(string text, string replacement), replaceAll(string text, string replacement), close()

The concrete return type for generic list methods is resolved from the receiver and is shown by hover on the actual expression.

Numeric type limits

Every concrete numeric primitive exposes compile-time MIN and MAX members:

int maxUsers = int.MAX
long earliest = long.MIN
float ceiling = float.MAX

They are available on int, uint, long, byte, float, decimal, and num. Integer limits match each type’s native width. For float, decimal, and num, MIN is the lowest finite value (-MAX); use a small positive literal when a smallest positive magnitude is needed.

List remove(value) removes the first equal value and returns void. The argument must match the element type; convert numeric values explicitly when needed. removeAt(index) removes and returns the element at a zero-based integer index, shifting later elements left. pop() removes and returns the last element. Both mutate the list and return its element type. An invalid index or an empty pop() throws a catchable bounds error without changing the list. pop() is constant time; removeAt() takes time proportional to the elements shifted.

Byte and text conversion boundaries

string.toBytes() returns an independent, mutable copy of the string’s UTF-8 bytes. Its length excludes the NUL terminator; an empty string returns an empty byte list. Changing the returned bytes leaves the source string and other byte lists returned by toBytes() unchanged, including when the source is a literal.

byte[].toString() copies the bytes and appends a NUL terminator. Radlang strings do not carry a separate byte length: an embedded zero byte terminates later string operations. This conversion does not validate UTF-8 and is not a binary roundtrip. For example, [0.toByte(), 65.toByte()].toString().toBytes() is empty, while [65.toByte(), 0.toByte(), 66.toByte()] becomes text "A". Keep arbitrary binary data (including generated token bytes) as byte[]; use an appropriate explicit text encoding before converting it to a string.