Lambda Prelude is shaped by hard "no"s. Each removes a category of confusion from production service code. The cost is that some patterns familiar from other languages have to be rewritten — a price worth paying when the resulting code reads top to bottom on the SVO axis (subject, verb, object) and stays readable as the service grows.

This page documents what was rejected, and why.

No pattern matching at the surface

(score > 90)
  ifTrue:  ['A' displayNl]
  ifFalse: ['B' displayNl].

Not:

match score > 90 with
| true  -> print_endline "A"
| false -> print_endline "B"

A Smalltalk-style program reads top to bottom, each line a message send to a named receiver. A pattern-match line breaks that flow — the reader's eye has to scan two branches simultaneously, and the relationship between the matched value and the surrounding state has to be reconstructed from the column structure of the branches.

Every conditional in Lambda Prelude is a message send: ifTrue:ifFalse:, ifPresent:ifAbsent:, ifEmpty:ifNotEmpty:. Every retry / timeout / option-destructuring is the same shape. Only the two-branch form has a value: with one branch, ifTrue: / ifFalse: answer the receiver — the Bool — because there is no value for the case the block does not cover, and nothing else to answer. Wanting a value means writing both branches.

The cost: ADT-style "one shape, many branches" code has to be rephrased as "many classes, one dispatch". This is rarely a real cost — most ADTs in long-running services are open hierarchies (HTTP responses, JSON values, RPC results, message types) and benefit from the open-extensibility of class-tag dispatch.

No class inheritance — protocols only

A class declares which protocols it implements; it inherits no concrete behaviour from a parent.

Object subclass: #Score
  fields:    (points)
  protocols: (Comparable, Printable).

Inheritance hierarchies grow in the direction of accidents, not in the direction of design. A class added today inherits behaviour that was useful for last year's class; nobody dares delete the parent because three other classes might depend on it through transitive inheritance.

Protocols are explicit. A class lists the protocols it satisfies. A protocol lists the selectors it requires. Default methods on a protocol are visible to every class that satisfies the protocol — but the relationship is named, not implicit through chain-walking.

The cost: helper methods that span multiple classes have to be moved to a protocol or duplicated. In practice this is good — duplication that doesn't share semantics shouldn't share code, and naming the shared semantics surfaces design decisions that inheritance would hide.

No instance variables — fields: records

Each object is a closed record of named fields. Updating a field means returning a new object.

Counter >> inc = Counter fields: { value: value + 1 }.

Mutable instance variables encourage state churn inside objects — methods that read field A and write field B in non-obvious order. The order matters; reordering breaks semantics; the order is not visible in the method's call signature.

Immutable records force the data flow to be on the surface: every method that "changes" state takes a value in, returns a new value, and the caller decides what to do with it. This is the same discipline a programmer reaches for in a functional language; Lambda Prelude just makes it the only option in surface code.

Updating one field of a wide record does not mean naming every other field: inst copyWith: { field: value, ... } answers a new instance with the named fields replaced and the rest carried over, with field names checked against the class declaration and each value against that field's type. It is an immutable update that the type checker sees through — unlike the reflective atField:put:, which cannot check either.

Equality follows from immutability too. = compares content: two instances of the same class are equal when their fields are, two Arrays when their elements are, two Dicts when they hold the same entries in whatever order they were added. What compares by identity is what has content that changes over time — actors, blocks, Futures, and handles: sockets, files, database connections, streams, compiled regexes. DateTime and Remote are values and compare by content. Dict keys, includes:, indexOf:, LpCache keys and Test assertEqual:to: all use this one equality, so an instance of a class you declared works as a key as it stands. The cost: incremental updates of large objects have to be expressed as new objects. Persistence (HAMT Dict, 32-way trie Array, structural sharing on records) keeps the actual cost flat in practice — see Internals for the data structure rationale.

No metaclasses

Classes are types. Class methods are associated functions, not methods on a metaclass.

Counter class >> of: n = Counter fields: { value: n }.

Counter class >> of: lowers to a top-level counter_of function. There is no Counter class class and no class of: someClass.

Reflection that needs to walk classes (System allClasses, String methodSelectors, dynamic class lookup) is kept out of the normal dispatch path and exposed through builtins. Reflection is ambient — those builtins are ordinary calls today, not gated behind an effect. Surfacing reflection as an interceptable effect, so a handler can audit, deny, or virtualize reflective operations, is future work.

The cost: code that wants to treat classes as first-class values has to go through the reflection API. The benefit: the static type system covers 100% of normal program flow without holes for "what if someone meta-changes the class table".

No non-local return

Smalltalk's ^ returns from the enclosing method, even from inside a block passed to another method. This is a source of bugs across actor boundaries — when a block runs in a different fiber, the "enclosing method" may have already returned.

Lambda Prelude replaces ^ with effect-based early exit:

Loop with: 0 do: [:state |
  (state > 10) ifTrue: [Break value: state].
  state + 1
].

Break value: performs an effect that the enclosing Loop with:do: handles. Cross-fiber, the effect handler is the fiber's own — escaping outside the fiber is impossible, and the type system makes the escape route visible in signatures.

The cost: idioms that depend on ^ (early-return helpers, custom control flow) have to be rephrased using Break, Exit, or Return effects. The benefit: programs that span actors stay consistent — there is no "this looked like an early return but the method was already gone" failure mode.

No implicit conversion — the type says which number and which time

The type of an expression follows what is written rather than the values reaching it, so no number converts on its own. 1 + 1.5 is a type error; 1 asFloat + 1.5 is how it is written. Integer, Float and Decimal are separate types, and a conversion happens only where the program writes one — Integer asDecimal, Float asDecimalScale:rounding:.

For money there is Decimal: an integer and a scale, with exact + / - / *. There is no division. divide:scale:rounding: names the scale and a rounding (Rounding halfEven and the rest), and there is no default rounding. How to round is part of the specification in a monetary calculation, not something a language should pick. That is why Decimal sits outside Number and implements only Arithmetic, the protocol declaring + - *: generic addition, subtraction and multiplication serve a Decimal, and generic division refuses one.

Time is split three ways for the same reason.

A conversion between them always names the zone it reads in — anInstant asDateTimeIn: tz, aDateTime asInstantIn: tz — so the mix-up where a value taken for server-local time was really UTC cannot happen in the types. A zone is a name from the IANA database (TimeZone named: 'Asia/Tokyo'), and the database is built into the runtime: the answer does not depend on the tzdata of the machine it runs on.

The cost: more to write, for numbers and for times alike; there is no case where asFloat or asInstantIn: can be skipped. The benefit: the precision and the zone a calculation runs in are on the face of the code, and a reader never has to guess at a rounding or an offset.

No nil — absence is a Maybe

There is no nil in the surface language. A lookup that may miss returns a Maybe, consumed with ifPresent:ifAbsent::

port := (OS getenv: 'PORT')
  ifPresent: [:p | p asInteger]
  ifAbsent:  [8080].

Maybe is a parameterised builtin — none, some:, ifPresent:ifAbsent:, isPresent, and ifPresent: for when only a value calls for something to be done, which runs the block and answers the receiver either way. A method with no meaningful result returns self (Smalltalk has no void), so absence never leaks out as a sentinel.

Absence is also kept apart from failure. A bounded socket read answers Maybe none at clean EOF and raises when the caller's deadline passes — one rule across TCP, TLS, and UDP. A timeout is a failure, caught with Error try:onError:; it is not an absent value that ifPresent:ifAbsent: would quietly swallow.

The cost: code that reached for a raw nil to mean "absent" has to name the absence as a Maybe and destructure it. The benefit: a value's type tells you whether it can be absent, the type checker forces every caller to handle the absent branch, and the "method returned nil and the next send blew up three frames later" failure mode disappears.

OCaml 5 effects, not Eio / Miou

Lambda Prelude is first-class on Windows (MinGW-w64) and Linux (x86-64). Other targets that OCaml 5 supports (macOS, ARM64, MSVC) are expected to build but are not part of the regular regression matrix yet. No POSIX-only primitives, no Windows-only primitives, no platform-specific async runtimes.

Eio and Miou are full async frameworks with their own runtime models — depending on either would bind Lambda Prelude to that framework's lifecycle decisions (fiber semantics, cancellation policy, structured concurrency choices, dependency surface). The actor scheduler is a small self-contained piece of OCaml using Effect.t and a custom run queue. Easier to read, port, and debug.

The cost: when something async needs to be added (a new I/O primitive, a new timer), Lambda Prelude has to implement it on the raw effect handler. The benefit: there is no second framework to learn, no version-matching dance with an external scheduler, and the entire concurrency story fits in the head of one engineer.

Tree-walk interpreter + AOT, not bytecode VM

The interpreter walks the AST directly. The AOT compiler lowers AST → OCaml source → ocamlopt → native binary. No bytecode VM, no JIT.

A bytecode VM is significant infrastructure to maintain for what is, in production, a one-time compilation step. AOT to OCaml inherits all of ocamlopt's compiler engineering — closure conversion, inlining, register allocation — at no additional cost. AOT builds already compile under dune's release profile, so binaries get -O3. Heavier optimisation (flambda2, aggressive specialisation) is a possible future direction, not a separate user-facing build flag.

The interpreter exists for iteration speed during development: fast load, fast retry, easy to extend with a new builtin. When the interpreter and AOT disagree, the AOT binary is canonical — interpreter behaviour that doesn't match AOT is treated as an interpreter bug.

The cost: deploying Lambda Prelude means deploying a native binary, not a script. Scripts that worked under the interpreter and not under AOT are bugs in the interpreter, not features of the language.

Virtual actors for distribution, not Erlang clustering

Lambda Prelude's local actor model — spawn, link, monitor, trapExits:, supervision — does not extend across machines. There is no cross-node spawn, no distributed link cascade, no global supervision tree.

What Lambda Prelude provides instead: a remote reference (Remote at:for:id:) that proxies a method send over JSON-RPC — statically typed when given a literal class, so an unknown selector is a compile-time error (a non-literal for: stays dynamically typed) — plus a virtual-actor (grain) backend that ships today, where state lives in an external KV (Redis, etc.) per call and a Redis lease with a fence token upholds cross-node single-activation under stated preconditions (a single, linearizable Redis, and owners that do not stall past the lease TTL). Each remote method invocation is a stateless RPC; correlation and supervision stay local.

Distributed-actor models (Erlang clustering, Akka Cluster) carry strong correctness guarantees about message order, link cascades, and process identity across nodes — guarantees that hold only under specific network conditions and that require operating two intertwined systems (the actor runtime and the cluster manager).

Lambda Prelude's target audience is the operator running a few resident services with a database, not a cluster operator. The virtual-actor approach is a smaller, more honest contract for that scale: a remote ref is a typed proxy to a class, state reads / writes go through an external KV, and the failure model is the failure model of the network and the KV — not a special distributed-actor failure model.

The cost: code that wants Erlang-style cross-node spawning and supervision cannot use Lambda Prelude. The benefit: code that uses Lambda Prelude within a single binary gets the full local actor story (selective receive, link, monitor, trap-exits, supervision), and code that needs to talk to other binaries does so through a contract that is the same shape whether the other binary is Lambda Prelude, Java, Go, or Python.

A module is a file — the name is not declared, the location decides it

One file is one module. A file does not declare its own name: the program's own file is Main, and an imported file is named by its path (stdlib/terios/rpc.lp is Terios::Rpc, sse.lp is Sse). What a file may carry at the top is two lines — what it imports and what it exports.

imports: (Http, Terios::Rpc).
exports: (Server, opaque Session).

The importing side has to spell the name the found file's path gives it, so one file never answers to two names: a module name declared in disagreement with where the file sits is not a state that exists. What a file imports is visible to that file alone, so protocol selectors resolve against its own imports.

A class is identified by its module and its name (Main::Counter, Shapes::Square). Two modules may therefore each declare a class of the same name, and a module may declare one named like a builtin without touching the builtin. A bare name resolves to the file's own class, else to the one class of that name an imported module declares, else to a builtin; two imported classes of one name are refused where the name is used, and Shapes::Square says which was meant.

A module exports only what its exports: lists. Another module's unlisted class is refused where it is named. A class exported opaque is usable from outside as a type and as a receiver of its methods, while building one with fields: and reading or replacing its fields with copyWith: / atField: stay inside its module — the module keeps its invariants.

The cost: moving a file changes its module name, and the files importing it have to be changed too. The benefit: a name has exactly one origin. Which file defines a class is answered by the name itself, and the same identity is what the class prints as, what crosses the wire, and what keys a grain's state.

Static types from day one, not opt-in gradual typing

Type inference is mandatory; annotations are optional. There is no untyped fallback, no Any, no dynamic mode for "just get this script running".

Gradual typing systems pay a runtime cost (type tags, narrowing checks, wrapper objects) for every value that crosses a typed / untyped boundary. The cost is rarely measured because the dynamic mode is treated as the "real" mode and the typed mode as an aspirational future state.

Lambda Prelude picks the other end: typed is the only mode. The interpreter and AOT both type-check before evaluation. Programs that won't compile under the type checker won't run at all.

The cost: there is no way to "just sketch something" without satisfying the type checker.

The benefit, stated exactly: no error the program made decidable reaches run time. That is weaker than "no type error ever reaches run time", and deliberately so. Selectors are Smalltalk's — a message names a method by name, not by a declared signature, and unrelated classes may answer the same name — so a checker that insisted on knowing every receiver would reject ordinary code, and one that gave up wherever a receiver was not written down would check almost nothing. The rule is neither: what can be determined is checked, what cannot is left to run time, and nothing is left to run time that the program has already made unambiguous. Only a send whose receiver has two genuine readings defers; where a single reading is determined, the send is checked, and the failure surface shrinks to I/O, external services, and user-provided invariants.

Being wrong in the permissive direction is not the smaller mistake. A send that is given up on has an unknown result, so every send consuming that result goes unchecked in turn — one unresolved comparison is enough to stop the two branches of the ifTrue:ifFalse: that consumes it from ever being brought together. The resolution rules exist to make deferral the last answer rather than the first; Internals has them.

Why these no's and not others

Some patterns rejected by other functional languages are kept in Lambda Prelude:

The criterion: a construct is banned when it hides data flow at a distance — across files, across method dispatch chains. Inheritance hides which parent method actually runs; pattern matching scatters a value's branches across non-adjacent columns. Both force the reader to reconstruct flow from context that lives somewhere other than the line being read.

A construct is kept when its effect is visible on the line where it appears. displayNl writes a line to stdout. actor ! msg enqueues a message on the named mailbox. An actor's loop argument captures state and forwards it to the next iteration. In every case, what the line does is what the line says — no walking the program to reconstruct it.