Maxon 0.5.0
Maxon 0.5.0 is released. Archives for every supported target are on the GitHub releases page.
What changed
Section titled “What changed”maxon buildskips the compile when nothing it read has changed since it last built that output, printingUp to date -> <path>; a build that does compile logs why.--rebuild, and the MCPbuildtool’srebuild, compile regardless. Two builds of one output take turns.- The standard library’s front-end work is cached on disk and shared between compiles, so a small
program builds in about half the time.
maxon cachereports the library cache andmaxon cache clearremoves it. maxon testtakes a single.maxtestfile and runs it alone, as does the MCPtesttool.Count, the standard library’s type for a number of things: Array, List and Vectorcount(),Json.arrayLength,Character.byteLength()and the string views’ counts return it, andScheduler.processorCount()compares with any of them with no cast.JsonDoc.hasChild, which says whether an object holds a key.clone()on a generic instance — aMap, aSetor a generic type of your own.- The language server names itself and its version in its
initializereply.
Changed
Section titled “Changed”- A typealias’s identity is its declaration rather than its spelling. Two declarations of one name are two types, even over the same range, and a value crossing between them needs a cast.
- A bare type name that reaches more than one visible declaration is E3063 in every file, including a file that declares one of them.
- A typealias declared inside a type carries its own visibility modifier, and unmarked it is private to its file; one inside an interface takes the interface’s. Naming a file-private one from another file, bare or qualified, is E3008.
- E3167 checks every type a signature names, including an interface’s requirements and the types a named alias reaches.
- Discarding a pure function’s result (E3064) is caught in more programs: a function that writes only
into values it created, one that calls a closure it can name, a search through a container’s
withIterator(), and aMaporSetlookup. A discarded call is judged by the overload it reached. - Diagnostics name types and overloads as source writes them:
Array with int,stdlib.Name,dir.Name,pick(String). - A program may not declare
BuiltinStringLiteral,BuiltinCharLiteralorBuiltinArrayLiteral(E2015). - Only a
.maxprojmarks a project for the language server. A file with no.maxprojabove it, up to its workspace folder, is checked alone against the standard library, and nothing is loaded for it. Opening a.maxprojloads its project. maxon test’s default per-file deadline is two minutes.- The compiler builds itself about a quarter faster, with about 30% less peak memory, and a function with many early exits no longer grows quadratically in code size.
Array.sortcould return unsorted output on arrays with many equal elements, and the stable sorts could reorder equal elements.- Array
equals,hashand==compared raw bytes, which is wrong for aStringor any other managed element, and could disagree with each other and withMapandSetkeys. They compare element by element through the element’s ownequalsandhash. - An array of floats compared, searched and hashed the wrong values on x64 and arm64, and trapped on
wasm32-wasi. ==on two values of a generic type compared their addresses. It calls the type’sequals, and is E3005 when the type declares none.- An array of a declared
enum Bytewith more than 256 cases truncated its values. - On Linux, a spawned child inherited every file the program had open, so a child reading a pipe the program was writing could wait forever for its end.
- A program declaring its own
Comparable,Equatable,HashableorErrorinterface lost the library’ssortandcontainson built-in types, and its services’ reply errors stopped conforming toError; the program’s own interface could not be implemented. - A ternary choosing between a parameter typed by a function-type alias and a declared function crashed the compiler.
- Two conformers binding an associated type differently crashed the compiler, and an associated type
bound by a type’s second
implementsclause, or by anextension’s, was not found. - A generic type nested in itself through its own instances made the compiler allocate without bound; it is E3184.
- Writing through a module
let’s record handed back by a function, or copying alet’s field into avar, compiled and faulted at run time; they are E3159, E3019 and E3078. - A copy that reached a promise — a
List.clone, or a generic type copying an array of promises — compiled, then crashed or left a green thread un-awaited. Every copy that reaches a promise is E3141. - A variable passed as a kept argument to a
spawnfactory aborted the program; it is moved, and a borrowed argument — a parameter, a field, an element — is E3138. - A static factory’s result, a static call through an instance alias, and an array literal passed at a type-parameter slot were refused or mistyped.
- A service reply that is a freshly interpolated
Stringwas refused with E3137. - The language server kept declarations a file no longer had, reporting a false cycle after a union was replaced by a type of the same name.
- A
--emit-ir-runtime=name the program lacks crashed the compiler instead of being refused.
Removed
Section titled “Removed”Utf8ByteCount,CodepointCountandUtf16UnitCount, replaced byCount.
Install
Section titled “Install”To install Maxon or upgrade an existing install, see Installation, which also shows how to install a specific release.