Design decisions
Decisions that ship in the language but look, at first glance, like they conflict with one of Jennifer's eight design stances. Each entry explains why the feature is not the kind of thing the stance was written to reject. The negative counterpart is Rejected features: proposals that were turned down because they did clash with a stance.
When in doubt, the stances table in ../design-stances.md is authoritative; this file is the reasoning record for maintainers.
The $xs[] = item; append form
Stance #1 ("one way per thing") normally rejects sugar that creates a parallel API. $xs[] = item; and $xs = lists.push($xs, item); do compile to the same operation, so the form looks suspect under that rule. It ships anyway because the three properties below set it apart from the rejected $i++ / += family.
$xs[]re-uses an existing operator slot; it is not a new operator.$xs[i] = item;already targets a list position via the[...]index-write syntax.$xs[] = item;extends that same operator to one position the existing syntax didn't cover - "just past the end" - by passing an empty index. No new token is introduced. Compare$i++: that proposed a new operator (++) competing with the canonical$i = $i + 1;. The bracket form has no new token to learn, no precedence to memorize, and no parse rule that wouldn't exist anyway.- Index-write semantics, not function-call semantics.
$xs[i] = item;mutates the binding's list in place.$xs[] = item;extends that in-place behaviour to the append position, where the function-call form ($xs = lists.push($xs, item);) needs an explicit reassignment to commit the new list back into the binding. So the bracket form isn't a "shortcut forlists.push" so much as the index-write syntax growing one more legal position. The two forms have different shapes: one is a write statement that mutates a binding, the other is an expression that returns a new list. - Write-only; no expression-context footgun.
$xs[]cannot appear on the right-hand side of any expression - reading "the element just past the end" has no meaning and is rejected at parse time.$i++'s real problem was that pre/post forms differ only in expression context, which is where the bugs hid.$xs[]has no expression context to hide in, so the analogous footgun cannot exist.
What this means for lists.push: it stays in the language and is canonical for any context that needs the post-append list as an expression value (passing it into another call, chaining transformations). The two spellings are not parallel APIs that do the same thing in the same context; they fit different syntactic positions - the bracket form for the in-place write statement, the function form for the expression value. That's also why the same argument doesn't license a bytes.push removal once $b[] = byte; ships: any future code that needs "a new bytes value with this byte appended" as an expression still wants the function form.
XOR (^) as its own operator
Stance #1 ("one way per thing") would normally argue against shipping an operator that's algebraically derivable from operators we already have - XOR is (a | b) & ~(a & b) in terms of the other bitwise primitives. It ships anyway because XOR is a CPU primitive with unique algebraic properties that show up at every use site:
- Self-inverse:
$a ^ $a == 0. - Round-trip:
($a ^ $b) ^ $b == $a- the canonical reversible transform (cheap obfuscation, parity bits, the classic in-place swap trick). - Bit-toggle:
$flags ^ $maskflips exactly the bits set in the mask, leaving the rest alone.
Forcing every XOR use site to write the three-operator composition would be the a - b ≡ a + (-b) argument: we still ship - because the composed form obscures the intent at every call site. Same logic applies here.
len is a language built-in, not a library
len(EXPR) is a reserved keyword and a primary expression in the grammar, not a function in any library. Stance #2 ("explicit over implicit") would normally argue that every name should be explicitly imported - which is exactly what every library obeys (use io;, use math;, etc.). The pre-M15.4 design had the core library auto-loaded as the one exception to this rule, so that len could be called without ceremony. M15.4 chose a different answer: promote len to a language built-in so the exception disappears, instead of preserving the auto-loaded library.
The case for keeping core auto-loaded (the path we didn't take):
- Minimal language surface area (one stronger reserved word avoided).
- The auto-loaded library was already justified once; doubling down is cheaper than redesigning.
- A future library that wants the same exception ("polymorphic structural primitive every program needs") could be added the same way.
The case for the built-in (what we ship):
- Stance #2 alignment is now uniform. Every name a Jennifer program reaches for either lives in the language (operators, keywords,
len) or behind an explicituse lib;. There is no third category. A reader can audit a.jfile's imports and know every external name in scope. - No special-case library machinery.
RegisterGlobal,globalFnsByLib, the alias-meaningless-for-globals-only-lib rule, the "library 'core' is automatically available" rejection, the "skip core from the available-libs error message" filter - all of that infrastructure existed to support one auto-loaded library. Withlenpromoted to a built-in, none of it is required. - Future polymorphic primitives have a clear home. If
len-like behaviour ever needs a sibling (e.g. a futureempty(v)), the decision is the same: language built-in or topic library, not "expand the auto-loaded list." - No
coreto keep tightening. M15.1 movedJENNIFER_VERSIONout ofcoreintometa; the charter discussion ("what qualifies forcore?") had already started chipping at the exception. Removingcoreentirely closes the question instead of arguing it indefinitely.
Tradeoffs accepted:
- Another reserved word.
lenis now a keyword - users can't definefunc len() {}. The same restriction existed under the old model (the M5-era "shadows builtin" runtime check), just enforced one phase later. - Migration churn for any out-of-tree code. Source that wrote
use core;errored with a friendly migration hint (since dropped: it is now the ordinary "unknown library" error); sources that definedfunc len()get a parse error pointing at the keyword rename. Pre-1.0 covers both.
RegisterGlobal / RegisterGlobalConst remain on the interpreter as exported API for compatibility, but no shipping library calls them; the in-tree consumer is gone. A later cleanup pass removes the infrastructure once the M10 collision-rule tests that exercise it migrate.
Half-open ranges
A range start..end (and the stepped lists.range(start, end, step)) is half-open: 1..100 yields [1, 2, ..., 99] (99 elements; 100 excluded). The English-reading stance Jennifer has applied to syntax (repeat ... until, word operators, as / init / in) would argue for the closed form - "from 1 to 100" in English includes 100. We deliberately don't extend that stance to value-generating runtime operations.
The English-reading argument applies cleanly to syntax, which is read once when learning the language. A range's value is what matters at every use site, and the cost of getting it wrong is paid every time the user composes ranges, partitions an iteration, or aligns a range with indexing. The half-open form makes those operations easier; the closed form makes the range read more naturally in isolation. We pick the operation-friendly form.
The case for half-open:
- Index alignment.
0..len($xs)yields exactly the valid 0-based indices for alen($xs)-element list. Closed would force0..len($xs) - 1- the off-by-one trap the half-open form was invented to eliminate. - Composability.
lists.concat(a..b, b..c)is exactlya..c. Partitioning a range at any point composes cleanly with no duplication and no+1adjustment. Closed would either duplicatebor requireb + 1..con every partition. - Stepping uniformity. Half-open stepping is always "emit while inside the open end" with no "did the step land?" question. The user never has to reason about whether
end - startdivides evenly bystep. - Consistency with slicing. Slices (
$xs[a..b]) and 0-based indexing are half-open. A closed range would be the only exception, a special case every user has to remember. - CS-tradition languages all picked half-open. Python
range, Go slice indexing, Rust.., C++ STL iterators[begin, end), JavaScript libraries. The "natural-syntax languages picked closed" framing is misleading: Ruby ships both (..closed,...half-open), Swift ships both (...,..<), Kotlin ships both (..,until). When you can ship only one because of stance #1, half-open is the more general choice - closed is recoverable asstart..end + 1, but the composition and index-alignment properties of half-open are not recoverable from closed.
The English-reading stance still wins for syntax (it costs nothing at runtime), but it's the wrong tie-breaker for a value-generating operation that's about behaviour, not prose. This entry exists to record the call for future tie-breakers: when an operation's semantics matter at every use site, the operation-friendly form beats the prose-friendly form.
We deliberately don't ship a closed variant (lists.rangeInclusive or similar) - stance #1 rejects parallel APIs, and the closed form is recoverable as start..end + 1 when the user wants "count 1 to N inclusive." A single-bound form with a default start (lists.range(end)) is also not shipped (stance #2: explicit over implicit).
The sql library's heavyweight driver dependencies
Jennifer states a dependency-free discipline for the library layer: every standard library is pure-stdlib, the carve-outs being gopkg.in/yaml.v3 (a parser too big to hand-roll), the CLI-scoped golang.org/x/term, and the Go project's own golang.org/x/crypto and golang.org/x/sys. The sql library breaks further: it takes two real dependency trees - go-sql-driver/mysql and jackc/pgx - which looks like a clear violation.
It ships anyway, for these reasons:
- Both drivers are pure-Go. No cgo, so static builds, cross-compilation, and the best-effort macOS / Windows artifacts stay clean. The one embedded engine that would need a multi-MB, TinyGo-hostile dependency - SQLite - is excluded and parked in horizon behind a build tag, precisely to keep this line from being crossed casually.
- The deciding factor is correctness maturity, not convenience. MySQL and Postgres are open TCP wire protocols, so a client is writable in pure Jennifer (the same shape as
redis/imap). But the mature drivers have absorbed a decade of protocol long-tail - every auth plugin (caching_sha2_password/ the RSA path, SCRAM-SHA-256), charset handling, NULL semantics, multi-result sets, server-version quirks - that a hand-rolled.jclient would re-derive one edge case at a time. For databases users depend on daily, that maturity is worth the dependency; the auth crypto becomes the driver's problem, not the language's. - It is not a performance concession. A database client is latency-bound (network round-trip + server execution dominate); client-side decode is the cost center only when streaming 10^5+ rows, a bulk workload Jennifer is the wrong tool for regardless of driver. So this is not "reach for a fast Go library" - it is "reach for a correct one".
- It is TinyGo-clean by construction. The build-tag split (
sqllib_std.goimports the drivers,sqllib_tiny.gostubs them) meansjennifer-tinynever compiles the trees; the language stays TinyGo-clean and the interpreter core is untouched.
The precedent (yaml) took one pure-Go dependency for a parser too big to hand-roll; sql extends the same judgment to a client too intricate to hand-roll correctly for engines people trust with production data. The bar stays high: a new heavyweight dependency needs this same "correctness maturity that a hand-roll would re-derive slowly and get subtly wrong" justification, not mere convenience.
Per-goroutine call-depth counter (concurrent web dispatch)
Turning the web framework from serial to concurrent request handling looked like a one-line change: wrap each request in a spawn. The naive version worked
- a fast request issued mid-way through a slow handler dropped from ~1700 ms to ~3 ms - but
go test -racereported a data race on the call-depth counter.
The call-depth guard (the RecursionError analogue that raises a catchable error before the Go goroutine stack overflows fatally) counts nested function calls. It originally lived as a plain int on the per-goroutine root env (i.global in serial code, a spawn snapshot's globals frame inside a spawn), which is correct for ordinary spawn bodies: each snapshot is a distinct root, so parallel spawns never share the counter.
Handler dispatch breaks that assumption. A handler is dispatched through meta.callMain into the entry program's interpreter, and CallMethodWith re-roots the handler frame at that interpreter's shared host.global. So the counter a handler's nested calls bump is host.global's single field - and several spawned workers dispatching handlers into the one shared host all increment it at once. The value-semantics guarantee that makes ordinary spawns race-free ("each spawn deep-copies its scope") does not extend across the meta.callMain boundary, because the whole point of that boundary is to reach the shared entry program, not a copy.
The fix makes the counter a *int threaded down the logical call chain rather than read off whatever root a frame happens to sit on. evalCall stamps the caller frame's counter onto the callee frame (callFrame.depth = env.depth) instead of reading effectiveGlobal's shared one, so a chain shares one counter while concurrent chains stay isolated.
The first cut of this minted a fresh counter at each cross-interpreter dispatch entry (CallMethodWith) - which is race-free, but wrong in a subtler way that an adversarial review caught: it reset the depth at every boundary crossing, so recursion that bounces through a dispatch builtin (meta.call self-recursion, a handler that re-dispatches itself via meta.callMain, a module function that calls back into the host) never accumulated past a single crossing and grew the Go stack unbounded - converting a catchable "call stack too deep" error into a fatal, unrecoverable Go stack overflow (a whole-process crash, e.g. a web handler taking down the entire server). A fresh counter per crossing is the wrong knob precisely because the milestone's own step-2 note warned "must NOT reset depth in a way that breaks meta.call recursion detection."
So the counter is instead threaded across the dispatch boundary too, not reset. dispatchModuleMethod passes the consumer's env.depth into the module interpreter's callMethodWithDepth; the meta.call / meta.callMain builtins carry the caller's counter through BuiltinCtx.Depth into CallByNameWithDepth / CallHostWithDepth; and those dispatch entries increment it (a crossing adds Go frames like any call). Only a genuine root entry with no caller chain - the CLI invoking the entry program, a testing harness - mints a fresh counter. The caller's counter is always goroutine-local (a spawn worker's own, or i.global's for the main goroutine), so threading it keeps concurrent chains isolated and lets a single logical chain accumulate across every boundary. The result is strictly better than the pre-change reach: recursion that bounces purely through meta.call (never guarded before, because those builtins bypassed evalCall's increment) is now catchable too.
Two consequences. First, the audit that gated the change (run under -race): the other shared interpreter state a concurrently-dispatched handler can reach is safe - the map hash-index is built only on an indexed write (a read never mutates the shared value), the resolver's CallExpr.Method / Fn caches are stamped single-threaded before any spawn and only read afterwards, the profiler's collector is mutex-guarded (and off the serve path anyway), and diagReq is atomic. Second, the one unsafe pattern is left to the user and documented, not papered over: a handler that writes a shared top-level variable of the entry program races another handler doing the same, because handler workers run against the same host globals (no per-goroutine snapshot across meta.callMain). That is the threads-sharing-memory hazard every language has; the guidance is to keep per-request mutable state in the request/response or a synchronized store, not a bare global a handler assigns.
The orm module maps rows as map of string to string, relations via a side Result
The orm module is a Data Mapper: a row is a map of string to string keyed by column name, not a user struct, and orm.load returns eager-loaded relations in a separate Result holder rather than nesting them into the row map. Both look, at first glance, like they fight stance #4 (rich, honest types) - why hand back stringly-typed maps instead of typed records?
Because the language has no struct reflection. A generic mapper cannot populate an arbitrary user struct field-by-field at runtime (there is no way to enumerate a struct's fields or set one by name), so a typed-row API would have to be hand-written per table by the caller - which is exactly what the caller does today by reading row["name"] and rebuilding a typed value explicitly. The map is the honest shape for "a row of unknown-at-compile-time columns": the database coerces the string values to column types, and values bind only through placeholders, so the safety story is intact. A typed-struct row form is recorded as rejected (it needs the missing reflection), to revisit if the language ever grows field reflection.
The side Result falls out of the same constraint. A map of string to string is homogeneous - it cannot hold both scalar columns and child-row lists without becoming a heterogeneous map of string to any, and Jennifer has no any (that is the json.Value opaque-tree decision restated). So eager-loaded associations live in an identity-map-style Result read through orm.related / relatedOne, keeping the row map a clean scalar record. It is the same "no language-level top type; walk heterogeneous data with explicit accessors" stance the json / toml / yaml libraries take.
Scientific-notation float literals
Stance #1 ("one way per thing") normally rejects a second spelling for a value that already has a canonical form, and 1.5e3 / 1500.0 are, on their face, exactly that. Scientific notation ships anyway, for the same three reasons the hex / octal / binary integer literals do (which stance #1 also let through):
- A notation that carries domain intent is not a parallel API.
0o755says "permission bits",0xDEAD_BEEFsays "bit pattern", and6.022e23says "physical magnitude" - each communicates something the plain-decimal form does not. Stance #1 rejects parallel APIs for the same job ($i++vs$i = $i + 1), not multiple notations that each read as a different kind of quantity. If hex-for-ints passes, exponent-for-floats passes by the identical argument. - For a whole class of values there is no other practical form.
1e-300cannot be written with a decimal point (300 zeros), and tiny p-values / physical constants are everyday values for themathspecial functions and thestatsdistribution / inference layer. So the notation is enabling, not merely convenient - the redundant-looking mid-range (1.5e3) is the minority case. - It closes a round-trip gap rather than opening one. The interpreter already prints exponent form for extreme magnitudes (
math.pow(10, 21)displays as1e+21,1e-08,...e-301) but, before this, could not parse that spelling back - a literal it emits was a syntax error on input. Adding the literal makes output readable back as source, which serves the "strict / no surprises at boundaries" stance (#4), not undermines it.
Mechanically it is a lexer-only change (readNumber scans an optional [eE][+-]?digits suffix; the exponent alone makes the token a FLOAT), additive and non-breaking (1e10 was a juxtaposition parse error before), and strict at the edge: an overflowing exponent (1e400) is a positioned parse error via the parser's existing strconv.ParseFloat, never an Infinity.
The magnitude boundaries are deliberately asymmetric, and this is not an oversight in the strictness. Overflow (1e400) errors because it produces Infinity, a non-finite value stance #4 bans outright (the same reason math.pow rejects an infinite result). Underflow (1e-400, below the smallest denormal ~5e-324) rounds to 0.0 with no error, because 0.0 is a finite, correctly-rounded value - a real number that behaves normally downstream, not the "NaN / silent garbage" the stance is written against. Erroring on it would misapply the stance (a finite zero is not non-finite), diverge from every IEEE-754 language (Python / C / Go / JS all yield 0.0 there, none error), and buy nothing: a program that then divides by the underflowed 0.0 hits the existing division-by-zero error anyway. So the rule is precisely "reject the non-finite (Inf / NaN), accept a finite result" - applied consistently, the tiny side stays a value and the huge side is the error.
String interpolation owns {}; the template libraries move to %name%
String interpolation (M24.19) makes an unescaped {expr} inside a cooked "..." string an evaluation slot. That reserves {} for the language, and it appears to violate stance #1 (one obvious way) twice - once by adding a second way to build a string beside + concatenation, and once by colliding with the {name} placeholder markers intl and validate used. Both are reasoned below.
Why interpolation despite + already existing. Concatenation and interpolation are not the same job. + joins two strings and requires an explicit convert.toString on every non-string operand; interpolation places a value beside its label and stringifies in place. The recurring real-world shape - "user " + convert.toString($name) + " has " + convert.toString($count) + " items"
- is exactly what interpolation removes:
"user {$name} has {$count} items". It is sugar (it lowers to concat +convert.toString), so it adds no new semantics, and the toolchain still sees each slot as ordinary code (the resolver,lint, andprofileall descend into it). Thef"..."opt-in prefix was rejected (rejected.md): the cooked / raw delimiter split already is the opt-in, so a raw'...'string is the "no interpolation" form.
Why the template libraries move off {} to %name%. Two libraries used a {name} placeholder for named substitution - intl.tr and the validate module's localize. Once a cooked "..." interpolates, a template written as a cooked string ("Hello, {name}") would try to evaluate {name} as an expression (and error on the undefined name). The fix keeps the language feature primary and moves the two secondary libraries to a brace-free %name% marker (with %% escaping a literal %), fully decoupled from interpolation and its \{ escape - a %name% template then reads the same in a cooked or a raw string. A sweep confirmed these were the only two {name}-placeholder consumers (JSON / TOML / YAML braces are serialization, io's %a braces are output delimiters). This is a pre-1.0 break to shipped libraries, taken because the language owning {} is worth more than a shipped library's marker syntax; see the M24.19 milestone.
markdown.toPdf is folded into markdown, not a separate module
M24.21 added Markdown -> PDF layout. The question was where it lives: a separate mdpdf module over markdown + pdf, or folded into one of them. It is folded into markdown as toPdf / toPdfWith / renderPdf, beside the existing toHtml / toAnsi.
The argument against folding is real and was measured. markdown gains import "./pdf.j", which pulls in pdf plus the font TrueType parser, so every markdown import - even a toHtml-only program - now loads ~2,700 extra lines of .j. Indicative cost on one machine: import time roughly doubles (~24 ms -> ~48 ms) and peak RSS grows ~6 MB (+37%). It is a one-time, per-process import cost, not a per-render one (toHtml runs at the same speed either way) - but it is a permanent tax the common case pays for a feature the rare case uses.
Folding into pdf instead was rejected outright: it inverts the layering (a low-level PDF writer would embed a markup parser) and would tax every pdf user with markdown + html + ansi.
markdown was chosen anyway because it is already a multi-format renderer - toHtml and toAnsi set the precedent, and toPdf is the third output, so one import and one namespace give a caller every rendering path (markdown.toHtml / toAnsi / toPdf). The unified, discoverable surface was judged worth the import tax; a program that needs markdown without PDF and cares about the few-ms / few-MB cost can take the single .j file and strip the pdf import. See the M24.21 milestone.
Library signatures are a side table, not part of registration
M28.9 needed a static signature (arity, argument types, return type) for every library builtin so jennifer lint can check a library call the way it checks a user function call. The obvious home is the registration call itself (RegisterNamespaced(lib, name, fn, sig)), which keeps a signature beside its implementation and can never name a builtin that does not exist.
It lives instead in internal/libsig: one file per library, a text block of name(T1, T2?, T3...) R lines in Jennifer's own type syntax. The reasons:
- The binaries do not pay for it. Only
lintreads signatures, andlintis not injennifer-tiny. A signature argument onRegisterNamespacedwould be parsed or stored by everyInstallin every interpreter (every module sub-interpreter included) of every run, for a tool most runs never invoke. - Registration stays a name and a function. Some 600 call sites keep one shape, and a builtin's own runtime checks remain the authority on what it accepts. The table states what lint may assume, a deliberately looser claim: a signature is never stricter than its builtin (
anywhere a shape is uncertain), because an over-narrow line would turn a working call into a false finding. - Drift is a test failure, not a silent gap.
TestLibsigCoversInstalledBuiltinscompares the table with whatInstallAllregisters - every builtin has a line, every line a builtin, every line parses, every library type it names is registered - which gives the side table the "cannot name a missing builtin" property the registration form would have had. - It reads as documentation. A block of one-line signatures per library is the shape editor tooling and generated reference pages want, without reflecting over Go code.
The cost is one more file to touch when a builtin is added or its arity changes; the coverage test names the missing line.
A library struct literal may leave fields out
A struct literal names every field: there are no field defaults, so a reader sees the whole value and a forgotten field is a load-time error, not a silent zero. That rule assumes the author controls both the type and its literals. For a library struct (net.Datagram, os.Result, archive.UnpackOptions) the author does not: the library adds fields as it grows, and each addition broke every literal of the type in user code. Adding truncated to net.Datagram did exactly that to a downstream test that built a fake datagram, at load, for a change that was no break at all for code reading the struct.
So a library struct literal may leave any field out, and the field takes its zero value - the value def d as net.Datagram; gives it, built by the same zero-value walk. Reasons this does not give up what the rule protects:
- It adds no new behaviour. Zero-declaring the type and assigning fields was always legal and yields the same value; the literal is now just the shorter spelling of it.
- The typo check stays. An unknown field is still an error at load, so
os.Result{exitCod: 1}is caught exactly as before. - User and module structs keep the full rule. There the author owns both sides, and "forgot a field" is the bug worth catching. A module is code the importer vendors or pins and can update its literals with; a library ships inside the interpreter and changes under the program on upgrade.
- Except a module in the system module directory. A bundled module (the
modules/that ship with Jennifer) ships with the interpreter exactly as a library does and changes under the program on upgrade, so its structs get the library exemption. Addingleewaytojwt.Policyshowed why: every three-field literal failed on the new build and the four-field one on the old, so a project tested against both had no literal it could write. The test is where the file lives (its canonical path is inside the system module directory), not how it was imported, so a local,-Ior vendored module stays strict, and so does a bundled module's literal of its own struct.jennifer lintfollows suit:L113reports only an unknown field in such a literal.
The precedent is Error, whose literal could already leave out its location fields. The alternatives were weaker: a documentation note that library structs may grow (true, but still breaks the code), and a lint nudging authors towards zero-declare plus assignment (a workaround the language should not need).
Core names spelled like a keyword
Stance 8's catalogue says no library function is spelled like a keyword (bitAnd, not and). Eleven core names are: lists.map, json.map / json.list, toml.map / toml.list, yaml.map / yaml.list, fs.list, channel.len, os.spawn and asn1.null. They stay. strings.repeat was the twelfth: when lists needed the same operation (0.27.0), the pair was named replicate in both libraries instead, and strings.repeat was removed in 0.28.0.
They are the most used names in the library: renaming them would touch nearly every program and every deck for a gain no reader has asked for. The parser reads a keyword after . as a name, so they are never ambiguous, and each one names exactly what its keyword means (json.map makes a map, channel.len is the length). The rule holds for every new name: the conventions survey lists these eleven as recorded exceptions, and anything else spelled like a keyword is a finding.
Error kinds outside a module's own
The catalogue asks a module to throw its own kind or a generic one. Three modules throw another, on purpose:
mcpthrowsjsonrpc.RpcError(kind"jsonrpc") from its HTTP transport. MCP is JSON-RPC: a caller already handlesRpcErrorfor every error the server returns, so a failed HTTP exchange arrives as the same type (reasonsays which) instead of a second one to catch.popthrows"pop3"for the server's refusals and"pop"for its own guards, both as onepop.PopError. The protocol's name and the module's differ; both kinds were released, and a kind keeps its name.s3presignthrows"s3", as its owns3presign.S3Error. It is the local half ofs3(M29.17): the same client and the same checks, so a caller that moves a presign froms3tos3presignkeeps its catch.
Weak algorithms by name, never by default
A security library could drop every broken or outdated algorithm. Some stay in crypto and hash, because a protocol or format Jennifer has to speak fixes them: SCRAM-SHA-1 derives with PBKDF2-HMAC-SHA1, older formats wrap keys with RSA-OAEP-SHA1 or encrypt with AES-ECB, Git and ETags name objects by SHA-1. Refusing them would not make those peers safer, only unreachable. The rule that keeps them from being picked by accident:
| Rule | How it holds |
|---|---|
| Offered by name only | The algorithm is always the caller's first argument (crypto.deriveKey("pbkdf2-sha1", ...)); there is no default to fall back to. |
| Never a default | No function, option or module picks a weak algorithm for the caller; a bundled module uses one only where its protocol requires it. |
| Tagged where names are listed | Every unknown-name list writes (weak) after it ("rsa-oaep-sha1" (weak)); hash writes (non-cryptographic) after md5 / sha1, which it offers for checksums. |
| Documented with what requires it | The library's page lists each weak name and the protocols that need it. |
| Dropped where nothing needs it | md5 is a hash name but not a key-derivation hash: no protocol derives a key with it. |
A weak name stays until the protocols that need it are gone; it is not deprecated for being weak.
encoding carries registered character sets only
encoding.encode / decode take a codec name, so any byte-to-text variant could be added as one more name. Each would be small; together they would turn the library into a catalogue of private formats. The line:
| Rule | How it holds |
|---|---|
| Registered sets only | A codec is a character set registered with IANA or specified by WHATWG or an RFC (UTF-8 / 16 / 32, ISO-8859-*, Windows-125x, Mac OS Roman, EBCDIC code pages). |
| No format-private variants | An encoding that exists only inside one file or wire format (Java's Modified UTF-8 in writeUTF streams and class files, CESU-8, WTF-8) is decoded by the code that reads that format, usually its deck: the variant comes with the format's own framing anyway (Java's 2-byte length prefix). |
| Strict codecs stay strict | A variant is never accepted by loosening a registered codec: "utf-8" keeps refusing overlong forms and encoded surrogates. |
Such a decoder is a short loop over bytes that rewrites the variant's special forms and hands the rest to "utf-8".
Kept as they are: the 2026-11-21 stance review
A review of every built-in library against the stances found these apparent breaks. Each stays, for the reason given; what had no reason was changed in 0.28.0 instead (M29.35 to M29.52). Four were settled at once by changing them (0.27.0): one cap (256 MiB) for every result a call builds, strings included; strings.join's separator optional like binary.join's; testing.runArgs / assertThrowsArgs for the argument-list forms; and fs.readSecretBytes beside readSecretString.
Two ways, each with its own job
sort/sortBy/sortWith.sortorders numbers, strings and bools with no call into Jennifer;sortBycomputes each key once and sorts in Go;sortWithcalls a comparator O(n log n) times for an order no single key expresses. The cheaper form is the one to reach for, so all three stay.maps.delete/maps.without. Both copy the map (value semantics);withoutremoves many keys with one copy where kdeletecalls make k.lists.first/lastbeside$xs[0].lastsaves thelenarithmetic of$xs[len($xs) - 1], and the pair reads as a pair. Unlikehead/tail(removed in 0.28.0), they return an element, which no slice does.io.readLine(prompt). The prompt and the read are one step: the prompt is written whether stdin is a terminal or a pipe, so a scripted run's output shows the same questions an interactive one does.meta.CAPABILITIES/hasCapability. The list for display, the predicate for a check.term.readByteis the untimed half ofreadByteTimeout;io.readBytesreads the same buffer for line-oriented programs.json.append(v, ptr, val)besidejson.insert(v, ptr + "/-", val). The-end marker is RFC 6901's, andinserttakes every pointer the RFC allows; refusing one valid pointer to keepappendthe only way would makeinsertan exception.appendnames the common case without building a pointer string."tar.gz"inarchivebesidecompress.pack("gzip", archive.pack(...)). One streaming pass and one cap; the two-step form holds the whole tar in memory first.json/toml/yamlencodePrettybesideencodeWith(v, {indent: 2}): the readable form every format has, by one name; only json has options worth a struct.isNull/isDatetimebesidetypeOf(v, p) == "null": a predicate is the shape of every other test (has,maps.has), and these are the ones read in conditions.
Choices that look inconsistent and are not
printf'smaxtruncates the value. Stance 3 keeps transformations out of format strings;maxis the exception because a column needs a width limit, not a substring: it counts runes and never changes what is printed when the value fits.- Argument order in
regex. The pattern comes first (regex.replace(pattern, s, with)) wherestrings.replace(s, old, new)takes the subject first. A pattern is a format, and the catalogue puts a format before the subject, asprintfandtime.formatdo with theirs. math.roundrounds half away from zero,decimal.roundhalf to even. Floats are measurements, where schoolbook rounding is expected; decimals are money, where banker's rounding avoids a bias over many sums.decimal.roundtakes a mode for the other.decimalaccepts a decimal string as an operand (decimal.add($a, "0.05")): a literal is the common case and is exact, where a float literal would not be; a float is still refused.xmlpaths are 1-based (name[k]), as XPath is, which every xml tool a reader knows uses; json, toml and yaml use JSON Pointer, 0-based.- Same names in different topics:
stats.range(the spread) andlists.range(a sequence),asn1.set(a SET) and the documents'set(upsert),decimal.scale/normalizeandlinalg.scale/normalize. Each is the field's own word; the library prefix always says which. - Percent and fraction.
stats.percentile(xs, p)takes p in 0 to 100, confidence levels and split fractions take 0 to 1, as statistics texts and NumPy write them. - One random source for
math,lists.shuffle,statsandml.math.randSeedmakes a whole analysis repeatable with one call, which a source per library would not; the crypto source is separate and unseedable. sql.exec/queryspread a single list argument into the parameters: without variadic user functions or a spread operator, a parameter list built at run time could not be passed otherwise.httpd.setMaxBufferBudgetis process-wide: the budget is the host's memory, which every server in the process shares; per-server budgets would add up past it.
Crypto and media
- Weak algorithms by name (
md5,sha1,rsa-oaep-sha1, AES-ECB): needed for interop (SCRAM-SHA-1, Git, legacy ETags and formats); the rule is its own section. mtweiKeygen/mtweiId/mtweiClientKeyincrypto: MikroTik's EC-SRP needs curve arithmetic that only Go does at an acceptable speed; the@deckyard/mactelnetdeck calls them (the bundled module did until 0.28.0).uuid.v4()/v7(), a function per version: two fixed versions, chosen when the code is written, never at run time.images.decodedetects the format: PNG, JPEG and GIF identify themselves by their first bytes andinforeports which.compressandarchiveneed the name, as a deflate stream has no signature.- PNG, JPEG and tar accept data after their end marker: the decoders stop there, nothing is lost, and writers append metadata; zip accepts data in front, which is how self-extracting archives work. zlib and deflate are the exception, as they drop a second stream (M29.41).