The full method-level reference for built-in classes and the standard library ships with each release for NDA partners. The page below summarises which classes exist and points to the relevant example files.
Core
Array and String use 1-based indexing per Smalltalk convention for at: / at:put: / indexOf: / copyFrom:to: and related index-bearing methods; at: 1 is the first element.
| Class | Notes |
|---|---|
Integer | Standard arithmetic, factorial, negated, timesRepeat:, to:, to:do:, bit ops, comparisons (min: / max: via Comparable), abs / squared / sign / between:and:. Integer division by zero raises a catchable error rather than trapping |
Float | An IEEE 754 double carrying the Smalltalk Number protocol under its usual names — arithmetic and the four comparisons, sqrt / raisedTo: / squared / reciprocal, exp / ln (natural) / log (base ten) / log:, the trigonometric functions and their inverses over radians with degreesToRadians / radiansToDegrees and the two-argument arcTan:, min: / max: / between:and: / sign, roundTo: / truncateTo: for snapping to a multiple, truncated / rounded / floor / ceiling / asInteger answering an Integer, isFinite / isNaN for a computation that left the finite range, and Float pi / e / epsilon / infinity / nan as class methods. A division by zero answers infinity rather than raising, as the hardware does. Nothing converts on its own: 1 + 1.5 is a type error and 1 asFloat + 1.5 is how it is written, so the type of an expression follows what is written rather than the values reaching it. A literal takes an exponent (1.0e10, 1e-9) |
Boolean, True, False | ifTrue:ifFalse:, and:, or:, not. With one branch, ifTrue: / ifFalse: answer the receiver — the Bool — since there is no value for the case the block does not cover; they cannot be used for a value, and ((x > 3) ifTrue: [5]) + 1 is a compile error |
String | A sequence of bytes, not of characters — 'あ' size is 3, and at: / copyFrom:to: count bytes, so slicing at an arbitrary offset can cut a character in half. This is what lets text, a socket payload and an encoded blob be one type with no conversion between them. To work in characters, charCount counts UTF-8 code points and charsFrom:to: / charAt: slice by that count (charAt: answers a one-character String, since a Char is one byte and cannot hold a multi-byte one). String fromCodes: builds one back from bytes. Slicing, concat:, asUppercase, asLowercase, trimmed, regex match, lines, replaceAll:with:, < |
Char | One byte. Character predicates and conversions (a multi-byte character is handled as a one-character String) |
Regex | compile: / compileIgnoringCase: (ignores the case of ASCII letters), then matches:, match:, findAll:, split:, replaceAll:with:, replaceAll:using: (each replacement built in a block), and search: / searchAll: answering a RegexMatch — groups read by number with group: or by name with named:, plus text / start / end. Perl syntax, linear in the length of the input. Lookaround and backreferences are not available (String's regex methods dispatch through this) |
Decimal | Exact decimals for money. The literal is Smalltalk''s ScaledDecimal form (1.50s2, 1.50s, 3s2); more digits after the point than the scale is a lex error. + / - / * are exact and there is no / — divide:scale:rounding: / roundTo:rounding: / asIntegerRounding: name the scale and a rounding (Rounding halfEven / halfUp / halfDown / up / down / ceiling / floor / unnecessary), and there is no default rounding. Comparisons plus abs / negated / sign / isZero / min: / max: / between:and: / scale. It sits under Object rather than Number, and nothing converts on its own (Integer asDecimal, Float asDecimalScale:rounding:, String asDecimal answering a Maybe, Decimal asFloat). JSON writes it as a string and the wire carries it as {"__class": "Decimal", ...}. SQLite, PostgreSQL, MariaDB and Redis receive every digit as text, and TORM''s expression evaluator compares and computes with it exactly |
Date | A day of the calendar with no time and no zone (Java''s LocalDate) — y:m:d:, parse:, today, todayIn:, year / month / day, dayOfWeek (ISO) / dayOfYear, addDays: / addMonths: / addYears:, startOfMonth / endOfMonth, isLeapYear, daysSince:, isoString / formattedAs:, comparisons with min: / max:, asDateTime |
DateTime | A calendar reading with no zone (Java's LocalDateTime) — now, parse:, fromMs:, y:m:d:h:min:s: (+ ms:), formattedAs:, isoString, the year … millisecond field accessors (millisecond precision), asInstantIn: |
Instant | A point on the time line (Instant in Java and Temporal) — now, parse: (RFC 3339), fromMs:, asMs, addMs: / msSince:, comparisons with min: / max:, isoString. A conversion to or from DateTime always names the zone it reads in: asDateTimeIn: / asDateTimeOffset: / asLocalDateTime, dateIn:, isoStringIn: / isoStringOffset: |
TimeZone | Named time zones from the IANA database, summer time included — named:, local, utc, names, offsetAt:, databaseVersion. The database is built into the runtime, so every machine reads the same release |
Error | Error raise: to signal, Error try:onError: to catch — the handler receives the message string (no exception-type hierarchy) |
Array | Persistent 32-way trie, with:, at:, at:put:, size, sort:, indexOf:, ,. `Array build: [:add |
Dict | Persistent HAMT, new, from:, at:, at:put:, at:ifAbsent:, at:ifPresent:ifAbsent:, includesKey:, keys, size, associations, and builtin do: / collect: / select: / reject: |
Set | Persistent, over two structures: an Array of the elements in the order they were first added, which is the order it iterates in, and a Dict keyed by element, which answers membership. So includes: and add: are one Dict lookup, effectively constant, while remove: rebuilds the Array, O(n) |
Maybe | Parameterised absence type, none, some:, ifPresent:ifAbsent:, ifPresent: for when only a value calls for something to be done (it runs the block and answers the receiver either way), isPresent |
Block | value, value:, value:value: ... valueWithArguments:, whileTrue:, ensure: |
Class | Class-side meta operations, reflection. name / className answer the name as written, qualifiedName the Mod::Name identity (which is what crosses the wire and keys a grain's state), plus superclass, protocols, methodSelectors and the rest |
Object | A value shows in two forms — printString / printNl / print: as a programmer reads it (a String quoted, 'it''s', a Char as $a, a Symbol as #name), and displayString / displayNl / display: as a person reads it (a String, Char or Symbol as its text alone, any other value as its printString). A collection, a record, a Maybe, a Future's result and an instance's fields show what they hold by its printString in both forms. asString is the displayString, WriteStream's << writes that, and print: writes the printString. A class decides how its instances show by answering printString or displayString, and is shown that way inside a collection too. Also =, ~=, printOn: (which writes the printString), className, isKindOf:, isMemberOf: (compares the class itself), fieldNames, atField:, atField:put:, copyWith: (typed immutable update — field names checked against the class, values against the field types), asObject, perform:, perform:withArgs: |
WriteStream | << writes the displayString (dispatching through the printOn: protocol) and print: writes the printString, plus nl, space, tab, position, isEmpty, reset |
Comparable, Arithmetic, Numeric, Enumerable | Protocol-bound mixins. Arithmetic declares + / - / * and is implemented by Number and Decimal; Numeric declares / and \\ and is implemented by Number alone — so generic addition, subtraction and multiplication serve a Decimal while generic division refuses one, a Decimal being divided only with the scale and rounding named. Enumerable is the wider protocol on top of the builtin iteration methods (detect:, min, max, sum, count, count:, detect:ifNone:, anySatisfy:, allSatisfy:, noneSatisfy:, joinWith:, flatCollect:, do:separatedBy:, firstIfEmpty:, lastIfEmpty:) |
Actor and Concurrency
| Class | Notes |
|---|---|
Actor | self, spawn:, !, receive, receive:, receive:after:do:, ask:, monitor:, linkTo:, trapExits:. monitor: / linkTo: on an actor that already died report the death instead of dropping the registration; an abnormal death that no monitor and no link can observe is reported on stderr |
Future | await, await:, resolved?, pending?, resolve:, fail:, new (manual construction), Future sleep: ms (a Future a timer completes once that many milliseconds have passed; the timer is not the creating actor's, so it keeps running if that actor stops) |
Down, Exit | Monitor / link failure envelopes carrying actor ref + reason |
Service Layer
| Class | Notes |
|---|---|
HTTP, HttpServer, HttpResponse, HttpRequest | HTTP server takes a block as handler; chunked + keepalive supported. start:handler: / startGraceful:handler: bind every interface, startHost:port:handler: / startGracefulHost:port:handler: bind one local address. HttpRequest >> peerAddress is where the request came from — what a rate limit keyed on the source needs; behind a reverse proxy it is the proxy's address, and whether to believe X-Forwarded-For instead is the application's judgement. HTTP parseMultipart:boundary: → MultipartPart (name / filename / contentType / bytes) for file uploads. The server, HTTP parseResponse:, Remote and the outbound client read a message with one parser: a line is at most 16 KiB and a header block at most 100 lines; a header name must be a token, so Content-Length : 10 is refused rather than kept under another name; Content-Length is digits only and two that disagree are refused; a chunk size is hex digits only; a body cut short by the peer closing is an error, not a shorter body. A request carrying both Content-Length and Transfer-Encoding, or a Transfer-Encoding whose last coding is not chunked, is refused, since its length cannot be known. The server allows a request the same read budget as the client (LAMBDA_PRELUDE_HTTP_TIMEOUT_MS, 30 seconds by default) for its line and headers, and again for its body; a keep-alive connection that stays silent that long between requests is closed |
LpHttpClient | HTTP client — get:retries: / get:headers:retries:, post:body:contentType:retries: / post:body:contentType:headers:retries: → HttpResponse. Reaches https:// endpoints, authenticating the peer against the system certificate store and the name in the URL — a host name against the certificate's DNS names, an address against its IP entries, and a name that is neither is refused rather than connected to unchecked. Host, Content-Length, Connection and Content-Type are written by the client and refused from the caller; header names and values are checked, so one built from untrusted input cannot split the request. Once connected it waits at most 30 seconds to be answered (LAMBDA_PRELUDE_HTTP_TIMEOUT_MS to change it), so a server that returns its headers and then stops fails the call rather than holding the calling actor. The RPC path (Remote, grains) speaks http only |
Smtp | the smtp plugin (Plugin load: 'smtp') plus the stdlib Smtp module. Smtp send: conf to: addr subject: sub text: body sends one message to one recipient over plain, STARTTLS or wrapped TLS, authenticating the peer against the system certificate store. The subject goes out as an RFC 2047 encoded word and the body base64-encoded, so a line the sender wrote cannot end the data early. One budget covers the handshake and every read (60 seconds, LAMBDA_PRELUDE_SMTP_TIMEOUT_MS), and the answer (SmtpResult) names the stage a refusal came from, so a wrong password and a rejected sender are told apart |
TCP, TCPSocket, TCPServer | Bounded socket I/O integrated with the actor scheduler. TCPSocket >> peerAddress answers the address at the far end. Both IPv4 and IPv6 are spoken: servers listen on both and clients connect over either, as RFC 8305 says — the two families are tried in parallel and the first to connect is used. listenHost:port: and UDP bindHost:port: take an IPv6 address ('::1'). In a URL or a database URI an IPv6 host is written in brackets (http://[::1]:8080/rpc, postgresql://app@[::1]:5432/db). listen: binds every interface, listenHost:port: binds one local address. Hostname resolution runs on a background resolver thread and the connect is non-blocking, so neither a slow DNS server nor a slow handshake freezes the domain |
TLS, TLSSocket | Tls.Engine driven, handshake / read / write park on I/O wait |
UDP, UDPSocket, UDPDatagram | datagram sockets — bind: / bindHost:port:, sendTo:port:data:, receiveFrom / receiveFrom: (bounded; raises when the deadline passes); a received UDPDatagram carries the source host / port for replies |
WebSocket | accept:on:, isUpgrade:, readFrame:, writeText:to:, writeBinary:to:, writePong:to:, writeClose: |
JSON, Json | JSON parse: answers a Json, one node of the document — navigated with at: / at:ifAbsent: / includesKey: / keys / asArray / size, and read with the method for the type the program expects: stringValue, asInteger, asFloat, asBoolean, isNull. No type is fixed by the first use, so code that reads one node as both an Integer and a String is refused where it is written. JSON serialize: writes ordinary values, and wireEncode: / wireDecode:allowedClasses: handle the class-tagged wire form |
JsonRpcServer, JsonRpcClient | JSON-RPC 2.0 dispatch — single, batch, notifications, error envelopes |
Remote | Remote at:for:id: — proxy to a remote class over JSON-RPC; typed against the target class's protocol when built with a literal class (a non-literal for: stays dynamically typed). Connections are reused per host and port instead of dialled per call, and one the peer closed in the meantime is retried once on a fresh connection |
TeriosServer, ServiceDispatcher, Res | TERIOS-style serviceName / requestDto / responseDto / errorInfoList envelopes |
Runtime
| Class | Notes |
|---|---|
File | read:, write:contents:, delete:, exists:, mkdirP:, removeDir: (empty directory), rename:to:, listDir:, isDir:, isFile:. For an append-only log, File open: answers a handle held open (FileHandle): readAt:size: (fewer bytes when the file ends first), append:, size, truncateTo:, sync, close, tryLock. A handle has no position of its own, so a read never moves where the next write lands, and a scan carries its offset forward as a value. tryLock takes an exclusive lock on the whole file without waiting and answers false when another holder has it; the lock belongs to the handle and is released when it is closed or the process ends, however it ends — on Linux it is flock, so closing some other descriptor on the file does not drop it, and a child started with OS spawn: does not inherit the handle |
OS | stdinLine, stdinAll, stdinPasswordLine (suppresses echo on Windows console + POSIX TTYs), hostname, env vars with defaults. flush — printNl ends its line and hands it to the screen, print does neither, so a prompt written with print needs flush before the read that waits on it. Clocks — time is the wall clock for calendar timestamps, monotonic (ms) and timeNs (ns) are monotonic, for measuring durations and periodic phase. Subprocess & watchdog — exec: / exec:input:, fire-and-forget spawn: / spawn:output:, running: liveness probe, kill:, gracefulShutdown: |
Log | Structured logging (info:, warn:, error:, key-value fields) |
Data
| Class | Notes |
|---|---|
DB, DBConnection, DbRow | SQLite (built in) — open:, exec:, query:, close. Parameters are named in the statement and given as a record with exec:with: / query:with: (db exec: 'INSERT INTO orders (name, due) VALUES (:name, :due)' with: { name: 'apple', due: aDate }), or given positionally with exec:params: / query:params:. Transactions are `withTx: [:c |
Postgres, PostgresConnection | PostgreSQL via Dynlink plugin (interpreter / AOT). A call waits for its answer on a thread of its own, so the other actors of the domain run meanwhile and a pool of connections serves queries concurrently |
Mariadb, MariadbConnection | MariaDB / MySQL via Dynlink plugin (interpreter / AOT) |
Redis, RedisConnection | Redis / Valkey via Dynlink plugin (RESP2 over scheduler-integrated non-blocking TCP), ping / get: (answers a Maybe) / set:value: / set:value:ex: / del: / incr: / decr: / exists: / expire:seconds: / keys: / auth: / cmd: (answers a Json) / close. Several commands go together through `transaction: [:tx |
TORM | SQL-file mapping over a port of Doma's 2-way SQL, plus the DAO / Entity macro DSL (dao: / entity: keywords; a plugin brought in with imports: (Torm)). Dialects: PostgreSQL / MySQL / MariaDB / SQLite / Oracle. Bind, literal and embedded variables; %if / %elseif / %else, with a WHERE, GROUP BY, HAVING or ORDER BY left empty removed and an AND or OR left leading removed; %for with <name>_index and <name>_has_next; %expand and %populate from an entity: class; Doma's expression language and functions; a file per database (Find-postgres.sql) taken over the generic one; Doma's naming types; and its builder settings (in-list padding, blank-line and comment removal). Where it differs from Doma is listed in docs/TORM.md, shipped with the implementation. A DAO method's answer follows its name — count* a scalar, exists* a Boolean, insert* / update* / delete* the rows affected, anything else the rows — and a clause entry can say it outright, { file: 'CreateUsers.sql', kind: #exec }, for a statement whose honest name carries no such prefix. A DateTime binds as a timestamp on each database |
Crypto
| Class | Notes |
|---|---|
Hash | SHA-256, SHA-512, HMAC-SHA-256 (hmacSha256:key:) |
Aes | AES-256-GCM |
Argon2 | Argon2id password KDF (RFC 9106), backed by system libargon2 |
JWT | Sign / verify |
Random | Random hex: — random hex string |
Base64 | encode: / decode: use the standard alphabet with padding, encodeUrl: / decodeUrl: the URL-safe one without it. Decoding refuses input it cannot read rather than answering something wrong |
Operations
| Class | Notes |
|---|---|
LpCache | In-memory cache builtin with size / TTL bounds (start:, at:, at:put:, at:put:ttl:). Expiry is measured on the scheduler's monotonic clock, so a step of the wall clock neither shortens nor stretches a TTL. Keys compare by value |
LpChannel | In-process pub/sub. subscribe:do: / publish:message: / subscriberCount |
Supervisor | one-for-one / one-for-all / rest-for-one strategies over monitor: + spawn:, with OTP's restart intensity: a supervisor that would exceed restarts: n within: seconds (5 seconds by default) stops its children and dies with an error, which whoever monitors or is linked to it receives |
Metric | Named in-memory counters for service-level instrumentation |
Test | run:do:, assert:, assert:message:, assertEqual:to:, fail:, summary |
Standard Library Modules
These ship as .lp files under stdlib/ and are loaded with an imports: (...) header at the top of the file. The standard library stays intentionally small; the modules below are the full set.
Core protocols
comparable.lp—Comparableprotocol with<-based defaults (>,min:,max:, ...)enumerable.lp— the widerEnumerableprotocol ondo:-based defaults (detect:,min,max,sum,count:,joinWith:,flatCollect:, ...). The core iteration methods are already builtins onArrayandDict; this is what you import for the rest, and for your own classesset.lp— persistentSet,add:/remove:/includes:(an Array for order, a Dict for membership)ordered_dict.lp—Dictvariant that preserves insertion order on iterationassociation.lp— (key, value) pair object; element type ofDict>>associations/Dict>>associationsDo:
Service runtime
http.lp— accept loop and keep-alive aware connection handler on top of theHTTPbuiltinjson_rpc.lp— JSON-RPC 2.0 server and client over HTTP (single / batch / notification / error)lp_server.lp— one-line exposure of an LP service as a JSON-RPC 2.0 endpointsse.lp— Server-Sent Events writer on top of HTTP/1.1 chunkedcache.lp— actor-owned KV cache with capacity (LRU) and optional TTLgrain.lp— virtual actors (grains):GrainServer/GrainStore/RedisGrainStore, directory + owner + lease single-activation, cross-node leasing with a fence token, pluggable storesmtp.lp—SmtpConf(host / port / security / user / password / sender) andSmtpResult(ok / stage / detail); the protocol itself is in thesmtpplugin
Connection pools (plugins — interpreter / AOT)
postgres_pool.lp— fixed-size pool over thepostgresplugin,withConn:APImariadb_pool.lp— fixed-size pool over themariadbplugin (MariaDB / MySQL)redis_pool.lp— fixed-size pool over theredisplugin (Redis / Valkey)
Supervision
supervision.lp— one-for-one / one-for-all / rest-for-one strategies onmonitor:+spawn:
TERIOS toolkit (stdlib/terios/)
terios/rpc.lp— TERIOS RPC envelope dispatch (serviceName/requestDto/responseDto/errorInfoList)terios/auth.lp— bearer-token auth scaffold + HTTP middlewareterios/transformer.lp— declarative JSON reshaping engine (DataTransformer port)terios/validators.lp— declarative validators for thevalidates:class-decl keyword
TORM toolkit (stdlib/torm/)
torm/entity_listener.lp—EntityListenerprotocol withprePersist:/postLoad:style hookstorm/select_options.lp— Doma-style immutable SELECT options (paging / lock hints)