Xo 0.49 release notes
Downloads: Xo 0.49.1 on GitHub,
with archives for macOS (Apple silicon and Intel, signed and
notarized), Linux (arm64 and x86-64), and Windows (x86-64, Authenticode
signed), and a SHA256SUMS file.
Getting started shows how to install
one. These notes cover everything since 0.48.2 (0.49.0 was not released).
Xo 0.49.1 adds arbitrary precision floats and rationals (big.BigFloat, big.BigRat), ML-KEM, AES and ECDH, server-sent events and JSON-RPC 2.0 in std, and Go’s FileServer and CrossOriginProtection to std/http. xo mcp and xo lsp now run on std/jsonrpc. The REPL keeps changes made through a var (xs.push(5)), and xolang.dev has a new guided REPL page at /repl/. Two native backend fixes matter on upgrade: a program could fail to build with “reads virtual register N before it is written”, and a program package named like a std module (a package sse) could fail to link.
Two changes can stop a program that compiled with 0.48.2 from compiling: ProcErr gains a Timeout variant, so an exhaustive match on it needs that arm, and std/protowkt’s 32 bit fields are Int32 and UInt32 (see Breaking changes). One behavior change needs a look if you log URLs: http.Url now keeps the user and password, so a URL’s display shows the password; log url.redacted() instead (see Behavior changes).
Highlights
- MCP and LSP on std/jsonrpc.
xo mcpanswers batches as JSON-RPC 2.0 says (they were rejected), and a request without"jsonrpc": "2.0"or a method gets Invalid Request with the specification’s messages; tools and results are unchanged.xo lsp(andxo dap’s framing) read and write throughjsonrpc.HeaderReader(header names without case, a 64 MiB body limit); a message that is JSON but not a request gets Invalid Request. - std/jsonrpc (decision 0603, spec/std.md 80):
encode,decode, a server’sanswer(batches), the newline and Content-Length framings, andConnwith calls and notifications both ways, requests served in tasks, MCP and LSP cancellation, andMethodsdispatch. - std/sse (decision 0603, spec/std.md 79): server-sent events (WHATWG text/event-stream): an I/O free parser (
feed), areaderover any read function,encode,comment,sendandheaders, andsse.Sourceandsse.subscribe, a client that reconnects with Last-Event-ID and the server’s retry. big.BigFloatandbig.BigRat(decisions 0602, 0608): Go’s big.Float (precision,RoundingMode,Accuracy,sqrt,text,parse_float) and big.Rat (lowest terms,rat_text,float_text, conversions both ways) as immutable values. Natively they are ports of math/big with its fast paths (Lehmer’s gcd, mantissas read in place): against Go 1.26.1 on linux/arm64, BigFloat quo takes 0.86 of Go’s time, add 1.04, mul 1.19 and sqrt 1.29; BigRat add and mul 0.88 and parse 0.74 (bench/results/bigfloat-vs-go-2026-11-11.md, bigrat-vs-go-2026-11-11.md).- Cryptography (spec/std.md 11): ML-KEM-768 and 1024 key encapsulation (Go’s crypto/mlkem; encapsulation in 0.29 of Go’s time, key generation 0.56, decapsulation 0.59, bench/results/mlkem-vs-go-2026-11-11.md), the AES block with the CBC and CTR modes (Go’s crypto/aes and crypto/cipher; CTR in 0.86 of Go’s time, CBC encryption 0.54, through the same hardware kernels as AES-GCM), ECDH over X25519, P-256, P-384 and P-521 (Go’s crypto/ecdh), and
crypto.xor(subtle.XORBytes). - std/http:
file_server(fs, strip), Go’s FileServer over an Fs: the Fs is the sandbox, soos.fs.sub(dir)orembed.Dir.fs()serves only what it holds.cross_origin(trusted, bypass)withcheck(req)andmiddleware(), Go’s CrossOriginProtection.http.Urlgainsuserandpassword(defaulted fields, so every literal still compiles), and a client request to a URL with a user sends Basic authorization unless it sets its own. - The REPL: an entry that changes a
varbinding through a method call (var xs = [3, 1, 2], thenxs.push(5)) is kept, wherexsstill printed[3, 1, 2];xo query typenow answers for avar’s name. In the playground’s REPL,:type EXPRanswers with the expression’s type and values print with their types (every:typesaid “sess/main.xo is not part of the checked modules”). xo replcommands::help(also:hand:?) lists the commands and the editing keys,:tis short for:type, and alt-Enter starts a new line in an entry that is already complete, as Shift+Enter does in the browser REPL.- xolang.dev/repl/: a full-height REPL beside a guided walkthrough of the language (values, bindings, functions, structs, enums and match, lists and maps, std, errors, the REPL’s commands), each entry one “type it” button away. It runs in the browser, in WebAssembly, like the playground.
Breaking changes
- Prelude (decision 0611):
ProcErrgainsTimeout(i/o timeout), returned by the newChild.set_read_deadline(clock, t), Go’sSetReadDeadlineon a child’s output and error pipes (read,read_errandread_linefail past the deadline; a timed outread_linekeeps its partial line;Noneremoves the deadline). Migration: add aProcErr.Timeoutarm to an exhaustivematchonProcErr, or a_arm. - std/protowkt (decision 0549): the fields protobuf-go types int32 or uint32 take Xo’s Int32 and UInt32, where they were Int:
Timestamp.nanos,Duration.nanos,Int32Value.valueandUInt32Value.value. Migration: convert where a program builds or reads them withInt32(n)(faults out of range;Int32.try(n)gives an optional) andInt(t.nanos). The well known types now derive Proto, soprotobuf.marshalandprotobuf.unmarshaltake them, and Empty keeps its unknown fields as protobuf-go does.
Behavior changes
- std/http
Urlkeeps its user and password:parse_urlused to drop them. A URL’s password now reaches its display, so logredacted()instead. An empty userinfo (http://@host) reads as none. - Go backend, std/http:
Request.query_allunescapes each pair in order with std/url’squery_unescape, as the native backends do, so two keys that read as one name come back in the query’s order on every backend (Go’surl.ParseQueryreturned map order). - Go backend, std/regexp: the Go backend runs the same Xo engine as the native backends (it called Go’s regexp), so its matches and errors are the native ones.
xo mcp: a request without"jsonrpc": "2.0"or without a method is answered with Invalid Request instead of being served.
Fixes
- Native backends, “reads virtual register N before it is written” (arm64 and amd64): a function that passes a value into an inlined callee that faults on it (a constructor’s argument check from another module) could fail to build. The block the unwinder enters from that check reused a constant its normal predecessor had made.
- Native backends, a package named like a std module: a program package named like a std module the program does not import (a package
ssebeside std/sse) shared that module’s symbol names, and a separately compiled build could fail to link with a duplicate symbol. Such a package’s functions are now named by its path. xo test, FakeNet patterns (native backends): a pattern and a request’s path split as the Router splits them, as on the Go backend:{rest...}takes""on/and after a trailing slash, a pattern ending in/is a subtree,{$}the exact slash path, and/users/{id}no longer answers/users/7/. Since 0.46.0,os.net.handle("GET https://h.test/{rest...}", ...)answeredhttps://h.test/with “no fake handler” natively.use c, C parameters namedn,v,corr: a C function whose parameters are named like the locals of xo’s C adapter, or like the function itself, failed to compile (“redefinition of ’n’” for a Bytes result) afterxo checkpassed. The adapters’ own names are prefixed now, and a failed adapter compile names the header declaration it came from.- Build cache: a link’s cache key holds the environment the linker reads (XO_BRANCH_REACH, XO_DATA_SHIFT, XO_STD_HALF), so a link made with XO_BRANCH_REACH is no longer served to a build without it.
- Front end cache: a closure’s cache entry (a std closure such as tls’s, recorded in one program and reused in another) replays where the types it uses were not made yet, where the build printed “the front end cache entry … did not replay” and was built a second time without the cache.
xo test --std-module: a module that another module’s declaration file imports (std/http.xo’suse std/multipart) is tested with that importer built from source:xo test --std-module=multipartfailed with XO0601 once std’s test variants were cached.- std/http:
r.with_host(h).host()ishon the native backends (it gave the Host the request came with). - std/crypto: a P-256 public key with a coordinate at or above p fails with Go’s text (
invalid P256 element encoding). - std/smtp: DATA dot-encodes as Go’s DotWriter. std/multipart: a bad header value’s error shows the key in canonical form, as Go’s.
- Separately compiled constants: the fix of 0.48.2 (a program’s constants number past std’s) is on main too.
Standard library
- New modules: std/asn1 (Go’s encoding/asn1 as a DER value tree:
parse,parse_prefix,Value.der,oid; struct marshaling by field tags is a later stage, decision 0601), std/textproto (Go’s net/textproto over bytes in memory:canonical_key,Header,Reader,dot_encode), std/random (Go’s NormFloat64, ExpFloat64 and Perm over any Rand), plus std/jsonrpc and std/sse above. - Prelude:
look_path(env, fs, name)(Go’s exec.LookPath),create_temp_dir(fs, dir, prefix)(os.MkdirTemp),File.seek(offset, whence)withWhence(os.File.Seek; MemFs files too),Bytes.trim_start_charsandtrim_end_chars,List.is_sorted,Float.copysign,frexp,ldexp,Float32.maxandsmallest_nonzero. - std/netip:
AddrPort(parse_addr_port,addr_port),split_host_portandjoin_host_port(host names too, Go’s error texts),Addr.prefix,next,prev,with_zone,prefix_from,Prefix.bits,is_single_ip,overlaps. - std/sql:
Rows.column_typesandRow.column_types(Go’s ColumnTypes), filled by the Postgres, SQLite and in-memory drivers; a driver of your own still compiles. - std/xml:
writer(indent), Go’s Encoder a token at a time. std/image: image/color’s types and models overColor(from_rgba64,cmyk,ycbcr,palette_convert,Image.convert, …). xo doc stdgives each module’s whole first sentence as its summary, and the std/http, sql, testing, json, crypto, log and task headers open with what the module is for.
Tools
xo test --backend=wasm(decision 0610): runs a module’s or a std module’s tests as a WASI module under the runner XO_TEST_EXEC names (node compiler/wasm/run.mjs), one test per process, with the same test world as natively (FakeEnv, the virtual clock, the harness’s report). What WASI preview 1 cannot run (sockets,use c) is skipped with its reason in the summary line, never counted as a pass. Every std test module passes on wasm.- Build time and memory (arm64 and amd64 native backends): a run of code generation changes, each with output unchanged (register tables indexed by register, label prefixes built once, a register allocator overlap test that answers early, the f64 SLP pass skipping functions without two Float loads, one-pass interval merges). A function whose result does not fit the registers writes it through an address its caller passes (decision 0564): the aiplatform/v1 (xo-lang/gcp) test build takes 0.745 of the wall time and 0.644 of the CPU on linux/arm64, and its peak memory at the inliner went from 6.93 to 5.63 GB. xo’s own code is 0.59% smaller.
use cneeds no flag: native is the default backend (decision 0248), soxo check,build,runandtestof ause cprogram work with no--no-gc; only--backend=goreports XO1201, and its note now says to drop--backend=go.- arm64:
==and!=of an enum whose variants carry nothing is one compare, not a call. xo test --std-module: the first edit build of a std module’s tests no longer parses std’s runtime files ahead of its check (std/json’s first edit: 201 to 130 MB and 226 to 196 ms on the Mac).- The playground and wasm programs: the playground’s compiler is 16.9 MB, 2.24 MB brotli, below 0.35.0’s 2.40 MB (it had grown to 58.0 MB and 4.45 MB on main), wide values move between memory and locals through shared helpers, large
varvalues stay in place instead of being copied in and out of each call, and its 30-entry REPL session peaks at 49 MB (87 MB before: values in memory pack their leaves, big blocks split and join, memory grows by what the heap needs). A build runs in a 200 KB stack (results of more than 64 leaves come back through a block). xo mod sumdb serve(decision 0568): a lookup of a new version is fetched in a background task and answered 503 withRetry-After: 5past--lookup-wait(default 50 s), so a large repository is no longer fetched again on each try;/healthzreportsLastRecordandLastError; scripts/modservices/warm.sh fills the log and proxy for every tagged version.
Known issues
- windows/arm64’s native backend is not the default yet (decision 0569).