Maxon 0.4.0
Maxon 0.4.0 is released. Archives for every supported target are on the GitHub releases page.
What changed
Section titled “What changed”- A debugger, on x64-windows, x64-linux, arm64-linux and arm64-macos.
maxon debugruns a program under it, interactively or from a batch of commands: breakpoints by line, function or address, with conditions; stepping; pausing; locals, expressions and backtraces; every green thread, which can be listed, inspected and held; and the program’s trace events beside its stops. It attaches from outside the program, so nothing is built into a program to make it debuggable beyond its.mxdbgsidecar. maxon dap-server, a Debug Adapter Protocol server over stdio, which the VS Code extension debugs programs and individual tests through.maxon test --list --buildbuilds a project’s tests and names each test, so a single test can be debugged.- Thirteen
debug_*MCP tools that drive the same debugger, andmaxon mcp-server --http, an HTTP transport on loopback with sessions. - Generic functions:
function f(x T) uses T where T is Equatable, withTinferred from the arguments. Integers, floats,StringandboolareEquatableandComparable. - Subtype aliases:
typealias X = int(range) implements Parentwidens to its ancestors with no cast, while siblings are refused and narrowing needs one. - Program-wide defaults: a top-level
default Key = expressionthat any thread reads withKey.current()and replaces withKey.register(x), for a service reached through an interface or for an immutable value.I.handleis a handle to any running service whose type implements interfaceI. SharedValue, a value every thread reads lock-free and a writer replaces whole.Log, a structured logger modelled on Go’slog/slog: levels, typed attributes, groups, and text and JSON handlers. A program logs with its first call.HttpServer, an HTTP/1.1 server on the green-thread scheduler.HttpClientdecodes chunked responses, answers a closed set of status codes, and takes a whole-exchange timeout and an optional body cap;TcpClient.connecttakes a deadline.Random, drawing from the operating system’s cryptographic source on every target.File.createText, which refuses a file that already exists; file errors tell a busy file, a denied access and an existing file apart.WallClock.nowUnixNanos, RFC 3339 formatting andCivilDate.- An enum or union that declares
implementswidens into that interface wherever atypewould. - A record whose fields are all
letand together fit 64 bits — narrow unsigned ranges,bits(n)andbool— is stored as one machine word, with no allocation. - Closures may be returned, stored in fields and containers, and passed to
async; captured interface values and nested captures work. - A union payload may be a float.
- A record holding a value at an interface type can be cloned.
maxon init, which scaffolds a project.__Builtins.scavengeMemory(), which returns freed memory to the operating system, and builtins that attribute the live heap and allocation churn by type.
Changed
Section titled “Changed”- Projects, task files and tests have their own extensions. A
<name>.maxprojfile marks a project and describes its builds, replacingbuild.maxon;maxon build <target>runs one of its targets. A<name>.maxtasksfile holds tasks, whichmaxon run <task>runs. Test files are<name>.maxtest. maxon run <file>is nowmaxon execute <file>.maxon <file>.maxonand#!/usr/bin/env maxonare unchanged.- Every command-line option is long-form:
-ois--output=and-tis--filter=. An option given to a command that does not take it is refused, and so is a bad--log=value. maxon test --filter=may be repeated, and each pattern must match a test.Runtime.yield()andRuntime.processorCount()areScheduler.yield()andScheduler.processorCount().- The trace-key recorder that was
LogisTraceCapture. - Arguments to an
asynccall or a service message, and the managed locals a closure captures, are moved; reading one afterwards is a compile error. Thelet-argument freeze and E3160 are gone. - A bare type name with more than one visible declaration is an error (E3063) rather than a silent pick;
qualify it with its directory,
stdlib.orexport.. A file’s own declaration wins. - A hidden type is hidden at every place a type can be named, along with its fields and methods.
- A function’s parameter, return and
throwstypes must be at least as visible as the function (E3167). - A function that declares
throwsmust be able to throw (E3168). - Inside a
testbody, a throwing call orawaitneeds notry. - Casting a literal to the type its destination already declares is an error (E3010).
- An array index must be the array’s
ElementIndex; aStringindex is refused. Arraycount()is anElementIndex. Several public stdlib aliases were merged intoElementIndex,EntryCount,BytePos,ByteandNetworkPort. - An or-pattern binding is refused on any case that does not bind it (E3129).
- A typealias declared inside a type or extension is a nominal type, and a private ranged alias belongs to its file.
- A full-range unsigned value such as
u64.maxpasses range checks; an unsigned subtraction is refused only when it borrows. - The language server checks a document against its whole project, so it reports what a build would. Hover and go-to-definition reach other files and the standard library, a window may hold several projects, and the server reports when it is loading one.
- A self-compile’s peak memory is roughly halved.
- On Windows, program arguments, environment variables, file and directory names, the working directory, the executable’s path and shared-memory names are UTF-8 for any Unicode text, and a child’s arguments, environment and working directory reach it as the characters they spell. A non-ASCII host name resolves through its Unicode form.
- A duplicate declaration across files is reported on the same file on every host: the one whose path sorts later byte by byte, and a free function rather than the method it collides with.
- A path holding a NUL names no file, a NUL in a subprocess’s program, argument, working directory,
environment or redirect path refuses the spawn with
spawnFailed, and a host holding a NUL, or an empty host, isresolveFailed. - A program started with its standard input, output or error closed has them opened on the null device.
-
Bytes written to a subprocess’s standard input were cut at the first NUL.
-
Subprocess.runhung when the child wrote more than a pipe holds before reading its input, and its timeout did not fire. -
On Windows, concurrently started children inherited each other’s pipe ends, so a child’s output did not end until an unrelated child exited.
-
A subprocess whose pipe could not be created was started without it on macOS, and on Windows the failure reported an unrelated error.
-
A failed subprocess start could close another file’s descriptor, and a released subprocess handle could release a process started after it.
-
A failed call’s error reason could be replaced by another’s after the green thread moved to another operating-system thread.
-
A variable passed to a parameter the callee reassigns — a module-level
var, a field, or a field reached through a chain — was not updated. -
Programs with a
boolglobal and green threads crashed at startup on arm64. -
A slot in use could be handed out twice under load on arm64, corrupting memory.
-
A record of narrow immutable fields spawned as a service crashed at shutdown.
-
A value moved in a match arm that ends
and fallthroughleaked when the match entered the next arm directly. -
A promise read out of a temporary container, or consumed twice from a field, crashed instead of being kept alive or refused.
-
A generic service could hand its own state to a caller, and a fresh container over
Treturned from one was wrongly refused. -
A generic method storing a type-parameter value taken by reference was refused, or miscompiled.
-
Managed globals were freed before a green-thread program’s last handlers ran.
-
A dropped coroutine that went on to wait on a socket hung the program.
-
On arm64-linux, signal handlers ran with an undefined mask and signal stacks could overflow; writes and waits interrupted by a signal failed; a child killed by a signal was not reported as signalled.
-
A timed-out subprocess left its children running.
-
On Windows, a subprocess started by name could resolve to a file Windows cannot run, such as the extensionless script beside
npm.cmd. -
A range check on an alias declared inside a type or extension was skipped.
-
Every runtime abort now prints its reason, and a
wasm32-wasipanic prints its trace. -
An undefined function reached through
try,await, a capture orfor … inreports E3004 at the call instead of an unrelated error.
Removed
Section titled “Removed”build.maxon,*.test.maxonas test files, and the-o,-t,--compiler,--version,-V,--helpand-hspellings.- E3099, E3105 and E3160.
Install
Section titled “Install”To install Maxon or upgrade an existing install, see Installation, which also shows how to install a specific release.