Settled decisions
Every language and project decision made so far, in one terse list — settled and open.
This page is the single record of decisions. A chapter of this specification elaborates each one; when a decision changes, this page and the chapter change together.
Settled
Identity and direction
- Avin is a natively compiled, garbage-collected application language with a deliberately small type system, a rich standard library and ergonomic syntax.
- Its type system, runtime and library are designed together: see design choices.
- Syntax stays very close to Sysl. Where Sysl has no form, this specification defines one in the same style.
- Execution speed is a primary goal.
- Programs are multi-threaded: threads run in parallel and share one garbage-collected heap.
- Typing is nominal. Classes instantiate objects; there are no duck-typed objects.
- Inference is a useful approximation of Hindley–Milner, not full HM: see inference.
- A call’s type argument that nothing at the call decides stays open until the end of the
enclosing function body, settled by the first later use that needs it (a branch it joins, a
store, a use as a value of a known type). If nothing settles it, it is
Nothingwhere the call names it only where a value is read out (settled 2026-11-04, below), and an error at the call otherwise. - The compiler is written in Sysl. Self-hosting is optional.
- The standard library is written in Avin. Sysl is reached through bindings written in Avin, which the compiler turns into shims that Sysl checks. The runtime is written in Sysl.
- The domain is
avinlang.dev. Compiler modules usedev.avinlang.compiler, and the standard library uses the reserved rootavin. A library the project publishes outside the core library is a package in its own repository of theavin-langorganization, with modules underdev.avinlang: parser combinators aregithub.com/avin-lang/parsing, moduledev.avinlang.parsing, written as literate Avin. - Building the Kutter video editor natively is a long-term application goal.
- Sysl’s Ada-inspired features (contracts and the like) are a long-term direction.
Syntax
- Functions and function types use
->, never=>. matchis postfix, with indentedpattern -> bodyarms.datadeclares algebraic data types.- Classes are final unless declared
openorabstract; overriding requiresoverride. - Inheritance is written with
::class C(…): Base(…), Trait, one superclass with its constructor arguments and then traits, as intrait A: B. - The receiver is implicit: members are in scope by their bare names, and
selfnames the instance. - Any method taking one argument can be called infix,
a max bfora.max(b), at the caller’s choice: there is no annotation that permits or forbids it. There is no postfix form. - An infix call names a method of its receiver’s type, resolved as the dotted call is; it never
falls back to a function
m(a, b), and a method of two parameters is not called infix with a tuple. It stays on one line unless the line ends with the method’s name, and then the argument is the indented block below. Keywords such asthen,do,isandmatchnever name the method. - A subclass’s constructor evaluates the superclass’s arguments, runs the superclass’s body on the
object, then stores its own parameters and runs its own body. The superclass’s arguments cannot
call a method or use
self; a parameter’s name in them reads the argument. - A subclass’s fields are its superclass’s, in order, then its own. Fields are never overridden.
- Only public methods can be overridden. An override takes the same parameter types and yields the same result or a type seen as it with no conversion (covariant results; see the Proposed entry on override results below). An override cannot be private. A method with type parameters of its own is overridden by one declaring as many, matched by position (bounds, once they exist, must match too).
- An abstract method is a method without a body, allowed only in an
abstractclass; an abstract class cannot be instantiated, and every concrete subclass implements each abstract method. - A call through a receiver whose static type is an
openorabstractclass reaches the override of the object’s class; a call through a final class’s type, andsuper.m(), are direct. ifandmatchbranches yielding different classes join to their nearest common superclass; where they have none, to the expected type when both conform to it, such as a trait.- A class implementing a trait’s method marks it
override, whether the trait’s method is abstract or has a default body, as an override of a superclass’s method is marked. A trait’s methods are public. A trait may override a default of a trait it requires, markedoverrideand with a body; in every type conforming to it, its body replaces the default. Redeclaring a required trait’s method withoutoverrideis an error. - A class conforms to a trait once: two different type argument lists for one trait, reached by any paths, are an error. A trait’s own default bodies count as inherited implementations, so a superclass’s method and a trait’s default of one name, or two traits’ defaults, must be overridden.
- A trait-typed call reaches the implementation through the class’s method table, at a position the trait has in every conforming class’s table (the whole program is known), so it costs one virtual call.
- A trait’s abstract
val name: Tis supplied by a public field of that name of each conforming type: a class’svalorvarfield, own or inherited, or a one-variantdatatype’s field through an impl. Avarfield satisfies aval; a method or a private field does not. Read through the trait it is a method table entry the compiler fills with a method that loads the field; read through a class type it is the field. It is never assigned through the trait. - Traits may hold state (settled, user, 2026-11-04). A trait declares a field with a value,
val name: T = exprorvar name: T = expr, and every class and object conforming to it stores one of its own. Through the class’s type it is the class’s field; through the trait, or a type parameter the trait bounds, it is read and assigned through method table entries the compiler fills with a method that loads or stores the class’s field. Construction runs the superclass first, then stores the class’s parameters, then computes the fields of the traits the superclass does not already conform to, a trait’s required traits before it and each trait once, in the order of the:list, then runs the class body. A trait’s field’s value may read the fields initialized before it and usesselffor nothing else. Only a class or an object conforms to a trait holding state, or requiring one that does: an impl of it for adatatype, a built-in type or a tuple is an error. A class declaring a field of a trait field’s name, or conforming to two traits that declare fields of one name, is an error. - A trait may re-declare a method of a trait it requires without a body, marked
override, with a narrower result (settled, user, 2026-11-04):trait SortedMap[K, +V]: Map[K, V]re-declaresoverride updated[W >: V](key: K, value: W) -> SortedMap[K, W], so a call through the sub-trait yields the sub-trait. The re-declaration takes the same parameters, type parameters and lower bounds and yields a result conforming to the overridden one, and shares its position in the method table, so one implementation serves both traits and must yield the narrowest result. Re-declaring a method that has a default makes it abstract again in the sub-trait: its implementers give their own. Declarations. - An
objectmay extend anopenorabstractclass, constructed from the top down as a subclass is, overriding its methods and conforming to it; it implements every abstract member it inherits. - A trait’s method, or an overridable class method, may have type parameters of its own and be called dynamically. The whole program is known, so each list of its own type arguments that a call through a table uses gets a slot of its own in the table of every type implementing the method, filled with that type’s implementation instantiated at those arguments; such a call also costs one virtual call.
- An
impladds methods and conformances, never state. Written in a class’s or an object’s module, its methods are the class’s own; for adataor built-in type, or written elsewhere, they are called directly. Inside them the receiver is implicit, as in a class, with a one-variantdatatype’s fields in scope by bare name. - The methods of
impl Trait for Typeimplement the trait’s methods withoutoverride, and each is a method of the trait or of one it requires. Adatatype’s method implementing a trait method is declared in an impl of that trait. - A
datatype conforming to a trait gives every variant’s descriptor the same method table, at the trait positions classes use, so a trait-typed call costs the same whatever the value is. - A generic impl of a trait writes the type’s parameters, in order, as its own:
impl[T] Show for Box[T]. An impl withoutformay also name a type built from its parameters (settled 2026-11-04, below). - Settled 2026-11-03: bounds are traits or classes, written
[T: A & B](spelled+until the intersection-bounds entry under Proposed made&the one spelling). A value of a boundedThas its bounds’ methods,vals and visible fields, and is a value of each bound’s type; type arguments are held to their bounds where written and where inferred, and a bound’s own type arguments are inferred from the argument. A call through a bound is direct in each instance, and goes through the method table only where the type argument is a trait type or an open class. An impl’s type parameters take its type’s bounds and write none of their own. - Settled 2026-11-03:
Selfis written only in a trait’s methods and names the implementing type; a trait mentioning it, itself or through a trait it requires, is only a bound. In its default bodiesselfis aSelf. A trait type is a type argument for its own bound when it does not mentionSelf. - Settled 2026-11-04 (user): polymorphic recursion, a cycle of generic code whose type arguments grow on every round, is a compile-time error naming the cycle, through functions, methods, local functions, lambdas and calls through traits and bounds alike; recursion whose type arguments do not grow is legal. Checking never runs without end on it.
- Variance applies only where both type arguments are reference types,
so it never converts:
List[string]is aList[Any],List[int]is not. Tuple parts and function results are covariant and function parameters contravariant on the same terms. - A variance error is reported in private members as in public ones; there is no escape for a
private
var. The methods an impl adds to adatatype are not variance positions; the traits its impls name are, except a trait whose members are all static (revised 2026-11-19, below). - Settled on the user’s delegation 2026-11-19 (branch
static-traits): static members are not variance positions of a class ordatatype, and neither is a conformance to a trait whose members are all static (with those of the traits it requires, at least one); the entry above read “the traits its impls name are” without exception, which refusedabstract class Vector[+T]statingimpl[T] Buildable[T] for Vector[T]withstatic newBuilder() -> Builder[T, Vector[T]]. Why it is sound: a static member is reached through a type, never a value. On the type, the call names the arguments (Vector[Animal].newBuilder()is that instance’s own impl); through a boundC: Buildable[A],C‘s own impl atC‘s own arguments runs, and aVector[Cat]is aBuildable[Cat], not aBuildable[Animal], sobuild[Vector[Cat], Animal](dog)is refused. No value of the trait exists (a trait with a static member is a bound, not a type), so no value path fromVector[Cat]toBuildable[Animal]exists either. The one path left is a type parameter bounded by a widened instance,U: Box[Animal]withU = Box[Cat]: a bound whose class ordatatype has a covariant or contravariant parameter reaches neither the type’s static members nor its conformances to all-static traits (U.make(dog)is an error saying to boundUby the trait). Kept as positions: a trait’s own static members (a type conforming toTake[Cat]conforms toTake[Animal]through the trait’s variance, sotrait Take[+A]withstatic take(x: A)is refused), a trait requiring an all-static trait, and a conformance to a trait with any member of a value. Alternatives: exempting every trait’s statics (unsound as shown); exempting onlyimplstatics and not the trait argument (still refusesBuildable[T]onVector[+T]); refusing static calls through every class bound (narrower than needed: an invariant class’s bound widens nothing). Tests:static_trait_variance,static_trait_variance_attacks,static_trait_variance_kept,programs/run/static_trait_modules. Review with the user: the widening-bound rule is new and visible (“boundUby the trait declaringmake“). - Settled on the user’s delegation 2026-11-19 (branch
static-traits): a trait type may implement a trait whose members are all static, as its own conformance:impl[A] Buildable[A] for Set[A]. It holds of the trait type itself, as the type a call names (Set[int].newBuilder()) or a bound’s argument, and is not inherited by the trait’s implementers (aHashSet[A]has its own or none) nor reached through a type parameter bounded by the trait type, whose argument may be any implementer. An impl of a trait with a member of a value for a trait type is still refused with the old message. Why: a collection literal typed by a trait (val s: Set[int] = {1, 2}) needs a builder the trait type names, and a trait’s conformance cannot be its implementers’ (each builds its own collection). It is built on the impls for instances of a type, matched against the trait type exactly rather than through its subtypes. Alternatives: inheriting it (wrong:HashSet‘s literal would build throughSet‘s builder); a companion object’snewBuilderreached by name (the conventionBuildablereplaces). Tests:trait_own_static_conformance,trait_own_static_refusals,programs/run/static_trait_modules. - A type pattern matches an object whose type conforms to the pattern’s type through variance, as
the checker’s subtyping does: a
List[Dog]held as anAnymatchesList[Animal]. - Settled by the user 2026-11-04: lower bounds on a function’s or a
method’s own type parameters, written first:
[W >: T],[W >: T: Display]. A lower bound is a covariant position, so a covariant trait declaresput[W >: V](key: K, value: W) -> Bag[K, W]as a virtual method; impl methods that are not variance positions are no longer the only way a covariant type takes its parameter in. A value of the bound is one of the parameter with no conversion, so a type argument is the bound or a reference type it is seen as. A call infers the join of the bound and the arguments,Anywhere they are references with no nearer common type; a written or expected type argument is held to the bound (the expected type’s part is refined, proposed below). An override writes its method’s lower bound or none. A type’s and an impl’s parameters take none. - The built-in types belong to the core library’s module,
avin; a conformance of one is written there or in the trait’s module. An impl that only adds methods may be written in any module (settled 2026-11-04, below). - Functions and methods may be overloaded by parameter types. A call takes the most specific overload that accepts its arguments, chosen at compile time; an ambiguous call is an error. Same-named declarations with the same parameter types are an error.
- Overloads are the functions of one name in one scope. A block’s local functions of a name hide every outer function of that name, whatever their parameter types, and a program’s own top-level functions hide the prelude’s of the same name.
- A local value (
val,varor a pattern binding) and a local function of the same block may not share a name, whichever is written first (settled, user, 2026-11-04). In a nested block, a lambda or as a parameter of the enclosing function, a local may hide an outer local function like any outer name (settled, user, 2026-11-04). - Generic local functions (declarations): a local function’s type
parameters follow the enclosing ones it shares, which its calls never write, so
pair[int](1)writes onlypair‘s own. A local function’s type parameter may not take the name of one already in scope rather than hiding it. Written type arguments and those an expected type gives a generic function used as a value are held to its bounds, as a call’s are (settled, user, 2026-11-04). - Choosing an overload tries integer literals and lambdas against each candidate’s parameter; every other argument is checked once on its own, and only its type is tried. A literal fits any parameter that can hold it.
- An integer literal prefers its own type,
int(orlongfor a literal too large forint), when that is all that separates the overloads:f(1)withf(int)andf(long), or withf(int)andf(real), callsf(int). This applies only where no overload is the most specific, and only to an overload that is also the most specific by the arguments that are not literals;f(1)withf(long)andf(real)stays ambiguous, and a genericf[T](x: T)loses tof(x: long)by specificity before any literal rule applies. - A method named without a call,
account.deposit, is a function value bound to its receiver: a closure holdingaccount, of the method’s type without the receiver. Inside the class, a bare method name is the same closure overself. This holds for a method declared with a parameter list,()included; a method declared with none (settled by the user 2026-11-12, below) is called by its name and has no method value. One declared with an empty list()is a value only where a function type is expected (Proposed 2026-11-12, below). - Settled 2026-11-03: a method value evaluates its receiver once, where the value is made. Through a
trait-typed or open-class receiver it calls the implementation the object’s class has, through
the object’s method table at each call; the object is fixed, so this is the implementation it had
when the value was made. The class’s type arguments come from the receiver’s type; a method’s own
are written (
box.pair[bool]) or decided by the expected function type, and one left undecided is an error. A method value takes every parameter, by-name ones still by name, and private methods are values only where they could be called. Two values of one method on one object are two closures, so===tells them apart. - Settled 2026-11-03:
loopis a statement that repeats its indented body (orloop do bodyon one line) until abreakorreturnleaves it.loopis a keyword. - Settled 2026-11-03:
do … whiletests at the end, so its body runs at least once. The body is an indented block closed by a line startingwhile test, or one statement writtendo stmt while test; an optionalelseruns when the test fails.breakcarries the loop’s value as inwhile,continueruns the test, and the test cannot read names the body declared. stringis a built-in type, not a class: it is final, has its own representation, gets its methods from the library throughimpl string, conforms to traits throughimpl, and is matched by the type patterns: stringlike any other type.- Settled 2026-11-03: the library’s string methods are
byteLength,charCount,isEmpty,nonEmpty,startsWith,endsWith,contains,slice,toUpper,toLower(namedtoUpperCaseandtoLowerCaseuntil the Proposed entry on one family of case names),trim,strip,stripLeading,stripTrailing,repeat,replaceandpadTobesidepadStartandpadEnd, with the reference library’s names (user, 2026-11-04), and, with the reference’s names and behaviour (user, 2026-11-04),stripPrefix,stripSuffix,capitalize(only a lower-case first character changes),stripMarginwith the bar or a given margin character (the characters up to U+0020 and the margin removed from each line’s start, the terminators kept), andhead,last,headOptionandlastOptionof the characters,headandlasttrapping on the empty string. A slice traps at its call when its offsets are out of order or outside the string, or either falls inside a character;repeattraps on a negative count. Casing is the simple mapping, one character for one; stripping removes UnicodeWhite_Space, andtrim, as the reference’s, the characters up to U+0020;replacereplaces every occurrence, left to right and not overlapping, and an empty pattern occurs nowhere. Methods yielding a collection or iterator (split,chars,bytes) wait for the collections. - Settled 2026-11-03: a built-in type’s impl in the core library may declare a method as an
@intrinsic, whose type takes the receiver first. - Settled 2026-11-03, the searches revised 2026-11-04 by the user:
indexOf(with an optional starting offset),lastIndexOf(with an optional last offset),indexWhere(with an optional starting offset) andlastIndexWhereanswer a byte offset, -1 when there is none, as the reference library’s do, and so do a sequence’sindexOf,indexWhere,lastIndexOfandlastIndexWhere, each with the same optional bound; a string’sindexOfandlastIndexOftake acharas well as a string. Offsets are bytes. A number is read whole:toIntandtoLongtake an optional+or-and ASCII digits, so"+3"is 3 and"-0"is 0, and refuse white space, separators and overflow ("-9223372036854775808"is along);toRealis correctly rounded, takes decimal only, and refuses white space,nan,inf, hexadecimal and a value too large to be finite. Revised 2026-11-04 by the user to the reference library’s:toInt,toLongandtoRealanswer the number and trap on a refusal withFor input string: "…", andtoIntOption,toLongOptionandtoRealOptionanswerNonefor it. - Settled 2026-11-04: the core library follows the reference language’s library in names and
behaviour unless it genuinely improves on it.
OptionhasisDefined,isEmptyandnonEmpty(notisSome/isNone),get(trapping onNone) andfilterNot; there is noorNull, since there is no null.charhasisDigit,isLetter,isLetterOrDigit,isWhitespace,isSpaceChar,isUpper,isLower,isControl,toUpper,toLowerandasDigit, classifying by the Unicode Character Database.isWhitespaceis true for the space separators except the non-breaking ones (U+00A0, U+2007, U+202F) and for U+0009 to U+000D and U+001C to U+001F, so it differs fromstrip‘sWhite_Space;isSpaceCharis the categoriesZs,ZlandZp.asDigitis the digit’s value in radix 36 (Unicode decimal digits give their value, ASCII and fullwidth letters give 10 to 35) and is -1 for any other character, never a trap. - Settled by the user 2026-11-04 (collections):
Map[K, +V]andSet[A]are traits, as in the reference library. The hash-based collections areHashMapandHashSet;TreeMapandTreeSetconform toSortedMap[K, +V]andSortedSet[A], which requireMapandSetand re-declare the updating methods with the sorted result. Map and set literals,Map(…),Set(…),Map.empty,Set.emptyand the two builders make the hash-based ones, typed as the traits;SortedMapandSortedSetcompanions, and a literal where one is expected, make tree ones. A method putting a value in takes[W >: V]. An update through a trait answers the same kind;map,collectandflatMapthrough the trait answer a hash-based collection. Maps and sets of different kinds with equal contents are equal, through the traits andAny, and hash alike. A map has nomkStringof its own: it joins its entries as pairs,(a, 1), throughIterable‘s. The ordered operations take the reference library’s names (user, 2026-11-04):headOptionandlastOption,head,last,firstKeyandlastKey(trapping when empty),minAfter(k)(the least at leastk),maxBefore(k)(the greatest less thank),rangeFromandrangeTo(inclusive),rangeUntil(exclusive),range(from inclusive, until exclusive),iteratorFrom(and a map’skeysIteratorFromandvaluesIteratorFrom), andreverseIterator, which the reference’s sorted collections lack and which is kept; the tree is balanced by weight, each side at most three times the other. - Settled by the user 2026-11-04: the elementary functions are a module,
avin.math(system library), with the reference library’s names, called asmath.sqrt(x)afterimport avin.mathor imported by name:PiandE;sqrt,cbrt,exp,expm1,log(natural),log10,log1p,pow,hypot;sin,cos,tan,asin,acos,atan,atan2(y, x),sinh,cosh,tanh;floor,ceil,rint(ties to even),abs,max,min(NaN when either is,-0.0below0.0),signum,toRadiansandtoDegrees. All take and givereal, follow IEEE 754 and never trap:sqrt(-1.0)is NaN,log(0.0)negative infinity. Not methods onreal. Settled on the user’s delegation 2026-11-19:abs,max,minandsignumalso haveintandlongoverloads (the only functions here with an integer meaning;math.abs(int.MinValue)traps as a negation does, andmath.max(1, n)on anintncalls theintone), written in Avin; the genericmax/min/clampoforderingstay for other types and the several-argument form. A call no overload accepts already names every overload (no overload ofmath.maxaccepts these arguments; the overloads are …); the two contradictory “expected” errors came fromrealbeing the only candidate. Branchmath-int-overloads. The reference’sround, which answers along, is left out until real-to-integer rounding is decided with the conversions. Bindings: one runtime function per function, over the methods of Sysl’sFloatonreal, since a binding names a function and these are methods. - A generic overload is compared by the same rule as any other:
f(x: int)is more specific thanf[T](x: T), which accepts anintwhilef(int)does not accept aT. - Whether a parameter is by-name does not distinguish overloads. An argument some candidate takes by name is delayed; an overload that takes it strictly evaluates it once, at the call.
- An overloaded function used as a value needs an expected function type, which chooses the
overload.
maincannot be overloaded. - Methods overload by the same rules, among the methods of a name the receiver’s static type has,
inherited ones included. A method is identified by its name and parameter types: an override, a
trait implementation and a method table position each match by both, so a subclass overrides one
overload and inherits the others.
overridematching no inherited parameter types is an error. - A clause is a line of the function’s name and arguments followed by
=, a guard or indented guards; a line of the same name followed by->or nothing is another declaration, so two abstract overloads may follow each other. - A class’s parameter list is its one constructor. Class parameters are private immutable fields
(
valmakes one public and read-only,varpublic and mutable), and the statements in the class body are the constructor’s code, run top to bottom when an instance is created. - Inside a class, a local, a parameter or a local function hides a member of the same name, and a
member hides a top-level declaration;
self.namealways reaches the member. In the class body, a class parameter’s name is its field, so it reads what an assignment to avarstored. - A private member is private to its class, not to one instance: the class’s constructor and methods, with the lambdas and local functions in them, may use it on any instance of the class.
- A class body cannot
return. A field declared in the body without a type has its initializer’s. - Initialization is checked at compile time. Through the last
field’s initializer, a class or object body uses
selfonly to read a field already set and to assign a field: a method call in any spelling (bare name,self.m(),super.m()), passing, storing or returningself, a method value ofself, and a lambda or local function using a field orselfare errors. Anopenorabstractclass’s body runs before its subclasses’ fields are set, so the limits hold for the whole of it, and it never calls a method a subclass may override. - An object is made once, before
main; its name is a value of its own type and cannot be called. It shares its name only with its companion class, whose constructor the name is in call position, while the bare name andName.memberare the companion. - Module-level
vals,vars andobjects initialize beforemain, each after the values its initializer reads directly or through the functions it calls, the rest in declaration order; a cycle is a compile error naming the chain. - Every function declaration parameter has an explicit type.
- A default argument is evaluated at each call that omits it, in the declaring function’s scope, and may use the parameters before it. Named arguments follow the positional ones, in any order; the arguments written at a call are evaluated in the order written, then the omitted ones’ defaults in parameter order. Names and defaults belong to a declaration: a function value is called by position. A variant takes its fields by name too. The default of a by-name parameter is delayed like any argument to it.
- Settled 2026-11-03: methods and class constructors take defaults as functions do. A method’s
default sees
self, the receiver’s members and the parameters before it; a constructor’s sees the parameters before it and noself. Defaults belong to the method that introduces the parameter: an override, and a method implementing a trait’s, takes them and may not declare its own, so a call’s defaults are the same whichever class’s method runs. A trait method’s defaults apply through the trait’s type. A method of one required parameter and defaults may be called infix. - A function may be defined by clauses: its signature with no body,
then lines
f(patterns) = body, tried in order. A clause is guarded inline,f(n) | n > 0 = body, or by an indented block of| condition = bodylines in which| _always holds; when every guard fails, the next clause is tried. Clauses must cover every argument, and a clause counts toward that only through an unguarded body. - Comparison patterns bind a name or
_beside one literal bound or between two (n < 0,0 <= n < 10), andn + kmatches an integer of at least the positive literalk, binding the value minusk. Both go wherever a pattern does, on integers (comparisons also on bytes and chars), and they count toward exhaustiveness, as literals and ranges do. - Variadic parameters are written
values: T*; by-name parameters are writtenvalue: -> T, with no memoization. - Blocks yield their last expression.
if,whileand loop values follow Sysl. - All of Sysl’s operators are supported, including comparison chains.
- Built-in types are lowercase (
int,bool,string,unit,char,real,iN,byte); other types are PascalCase; functions and methods are lowerCamelCase. These are conventions, not syntax rules. intisi32andlongisi64; they are the only integer aliases. Signed integers of any fixed width are available. There are no unsigned integer types.realis binary64, and there is no single-precision type.charis a Unicode scalar.byteis an octet (0–255) for binary data, with bitwise operations and no arithmetic.- Integer overflow traps.
+%,-%,*%wrap and+|,-|,*|saturate, explicitly. - A sequence is indexed by calling it:
xs(i), andxs(i) = vto assign. Sequences implement function types, and any library type can implement a function type throughapply. [1, 2]is an immutableVector,{1, 2}aSetand{"a": 1}aMap, unless the expected type asks for another collection (val b: Buffer[int] = [1, 2]), which the literal then builds.{a: 1}means{"a": 1}.{}is the empty Set andMap.emptythe empty Map.x :: xsprepends to an immutableList, andhead :: tailis a list pattern, for recursive list code.::is right-associative.- Settled 2026-11-03:
List[+T]is the core library’sdatatype with variantsCons(first, rest)andNil.::and list patterns always mean the core library’sList, whateverList,ConsorNilname where they are written. EveryListmethod loops rather than recursing, so no length deepens the stack, and lists compare and hash by contents and order lexicographically when their elements are ordered. - Sequences are matched with the brackets that build them:
[]matches any empty sequence and[a, b]any sequence of exactly two elements. Bufferis the only growable mutable sequence, andDequethe mutable sequence for both ends. There is no mutable list type: every collection has a builder, through one library trait, andList‘s builder appends in constant time and yields an immutableList...and..<expressions construct iterableRangevalues.- An array is made with every element set, by
Array.fill(n, value),Array.tabulate(n, f),Array.empty()orArray(a, b, c)(see “A collection is made by naming its type and listing its elements” below); Avin has no null, so no array holds an unset element.xs(i)callsxs.apply(i),xs(i) = vcallsxs.update(i, v), and the compound,:=and++forms evaluatexsandionce. A call with untyped arguments before=is an assignment, so a local function’s declaration types its parameters or has none. - A range’s step is set with
by; a step of zero traps, and iteration never steps past the limit or the type’s largest or smallest value. - A
forwithyieldis comprehension sugar overmap,flatMapand filtering; aforwithoutyieldloops over the source’s iterator. - The collection hierarchy is rooted at
Iterable, andIteratoris itselfIterable. printandprintlnare ordinary library functions (settled 2026-11-04). Both take any values, shown as interpolation shows anAny(below), and separate several with,, which is not a tuple;printlnends with a newline andprintdoes not.print()writes nothing andprintln()writes a bare newline;eprintandeprintlnare the same for standard error.println(debug(x))selectsDebug.debug(x)yieldsx‘sDebugform as a string.Writerwrites strings (withwriteChar,writeInt,writeFieldandwriteSpacesbesidewrite);FormatSpeciswidth,precisionandleft;toString()is a default body ofDisplay.- Settled 2026-11-04 (user): a value of
Anyor of any trait is shown by the type it has at run time.Anyand every trait meetDisplayandDebugwhatever they declare, as every type meetsEq: such a value meets those bounds, hasdisplay,debugandtoString()and is interpolated, and renders through its own type’s implementation, found through its type record, soSeq[int]prints as the vector it holds. It does not convert toDisplayorDebugas a value, so a value of either trait holds only objects that implement it, and is still shown through its method table. A type with no implementation of its own renders as its name (Cat,Box[int]; a function value<function>), never an address. Static types keep their rule: a class or data type needs its ownDisplayto meet the bound or be interpolated, a type parameter its bound’s. A trait takes no impl ofDisplayorDebug: its values are shown by their own types, which keeps one rule. - Settled 2026-11-04 (user):
print,println,eprintandeprintlnare each ONE ordinary library function takingvalues: Any*, with no other overloads, and the compiler treats them as it treats any function: none, one or several values, several separated by,.println(1, pet, xs)withpet: Petandxs: Seq[int], a function value and a class with noDisplayall print, each shown as thatAnyis in an interpolated string (by its type’s ownDisplay, or its name). A sequence is one value; onlyxs*spreads it, as for any repeated parameter, and then only a sequence ofAnyor of references. As a valueprintlnis a(Vector[Any]) -> unit. The cost is stated plainly: a program that prints through them boxes every number,char,boolandunitargument, makes a vector of the arguments, and gives every type record its rendering entry, since any value may reachAny‘s rendering; a string or an object is passed as it is. A program that wants none of that writes toStandardOutputthrough aDisplaybound. - A built-in type conforms to a trait through an impl and implements every method of the trait, since a trait’s default bodies are shared by objects and a built-in value is not one.
- A variant’s fields take defaults, each a function of the fields before it, as a constructor’s parameters do.
- Avin has Sysl’s full string interpolation and formatting.
- An interpolated string is a method call on
StringContext:p"a $x b"isStringContext(["a ", " b"]).p(x).s,fandraware library methods, and a program defines its own interpolator by implementing a trait forStringContext. - A user-defined interpolator is visible where it is imported (settled by the user, 2026-11-04): in
the module that declares it, in a file importing that module whole, and in a file importing one of
its declarations by name.
s,fandrawneed no import. A module that merely imports another does not pass its interpolators on, and using one that is not in scope is an error naming the module to import. - Interpolated literals follow Scala’s lexing (settled 2026-11-04). A backslash and a
"or\after it are skipped as a pair, soraw"a\"b"holdsa\"b,raw"a\"is unterminated andraw"a\\"ends, holding two backslashes;$"is a double quote and$$a dollar sign in every interpolator. The lexer reads no escape: a part reachesStringContextas written, and onlysandfprocess escapes, sop"\d"is fine ands"\d"is an error. A backslash is otherwise an ordinary character (raw"C:\dir",\$namestill interpolates). - Nested helper functions see their enclosing scope. Closures are full closures, and
returninside a lambda is local to the lambda. matchis a value-producing expression with full destructuring.- A tuple needs no parentheses where it fills the rest of a line:
= a, b,return a, b, a block’s line. Bindings take tuples apart (val q, r = divmod(n, d)), anda, b = b, ais a multiple assignment: a statement that makes the whole right side before storing anything, with compound forms that read every place first. Its places arevarlocals,varfields and module-levelvars, each field’s object evaluated before anything else. - Inside brackets whose commas separate items (call arguments, tuple and collection literals), a
returnorbreakvalue stops at the comma, sof(a = return 1, b = 2)has two arguments; a parenthesisedreturn 1, 2is two tuple items, andreturn (1, 2)returns a tuple. An indented block inside the brackets starts a line again, up to a last line that closes the brackets, whose comma ends the block; a one-line lambda body never takes a comma list. - Actors are built into the language:
actordeclares one. - State machines are built into the language:
machinedeclares one, andstatedeclares each of its states. - Slate’s
dalis not part of Avin. Anyholds a value of any type. A value converts to it at a single site (an argument, a binding, an assignment, a field, a result, a tuple part written out, a branch expected to yield one), never inside a container. A string, a tuple and adatavalue need no box, being objects whose header names their type; numbers,char,boolandunitare boxed.- A type pattern
x: Tmatches a value whose run-time type isT, a subclass of it or a class conforming to it, with type arguments compared exactly. One that can never match is an error; one covers only where the matched value’s type already conforms toT. In a clause a type pattern naming the parameter’s own type is an error. - Every type has
==and a hash. Built-in types, strings, tuples anddatacompare and hash by value; class instances,objects and closures by identity, which always agree, until the class implements or derivesEq.derives Eq, Hashgives both from the same fields; implementing one of==and the hash without the other is an error. Keeping a hand-written pair consistent is the programmer’s responsibility. ==between two values whose static types share no common type is a compile error. OnAnyand on trait-typed values==is decided at run time through the type’s entries: values of different run-time types are unequal.===stays defined only on reference types; where it meets anAny, a trait or a type parameter, see the identity entry settled on 2026-11-05.- Settled 2026-11-03: the operator traits are the core library’s
Eq(equals(other: Self) -> bool),Hash(hash() -> long),Ord: Eq(compare(other: Self) -> int, withless,lessOrEqual,greaterandgreaterOrEqualdefaulting from it), andAdd,Sub,Mul,Div,Rem(add,subtract,multiply,divide,remainder, each(other: Self) -> Self) andNeg(negate() -> Self). Every type conforms toEqandHashimplicitly;==on a type parameter still needs a bound that is or requiresEq. The built-in types implement the traits their operators have, in the core library, and an operator on a built-in type is the machine’s operation, in generic instances too. - Settled 2026-11-03: an impl of a trait may bound the type’s parameters further (
impl[T: Ord] Ord for Box[T]), making the type conform only for type arguments meeting them; on data types and classes, for any trait. - Settled 2026-11-03: a conformance through such an impl to a trait that is also a type holds wherever one is decided: at conversions (as a covariant type argument too), in type patterns, and for calls of the trait’s methods, which an instance missing the bounds does not have.
- Settled 2026-11-03: a generic type’s derived
Ord,DisplayandDebugare impls bounding each parameter by the trait, so they hold where the type arguments implement it. - Settled 2026-11-03: arrays compare and hash by contents (
===stays identity); arrays and lists display as[1, 2, 3], theirDebugas["a", "b"], each only when the elements do. - Settled 2026-11-03:
derivestakesEq,Hash,Ord,DisplayandDebug. A class derives from its constructor parameters, plain,valandvaralike, and not from fields its body declares; a data type from each variant’s fields. A class derivesEqandHashtogether, andOrdonly with anEqby the same fields, derived or its own; a data type has both already, so deriving them there changes nothing.DisplaywritesName(a, b), each field in its ownDisplayform, and a variant without fields as its name;Debugwrites the same shape with each field’sDebug, so strings inside are quoted. A width pads the whole. Deriving a trait the type also implements, or one a field’s type does not implement, is an error naming the field. A generic data type’s derivedOrdholds for the type arguments that are ordered; derivingDisplayorDebugon a generic type, andOrdon a generic class, needs the parameters bounded by the trait where the type declares them. - Settled 2026-11-03: every data type has
DisplayandDebugwithoutderives, where its fields have them, conditional on its type arguments as a derived one is;derives Display, Debugon a data type means the same. An impl of the type’s own replaces the automatic one, with no conflict. A field without the trait leaves the type without it, which is an error only where a use needs it, naming the field. A program that never shows a value compiles none of this code. Whatderivesand the automatic impls name are the core library’s traits, whatever the module declares or imports under the same names. x.equals(y)andx.hash()may be called on a value of any type parameter, bounded or not.- Settled 2026-11-03: a type argument a call’s arguments decide is the
join of the types they give it where a value is read out, as two
branches’ types are joined; the first argument does not decide it alone, so
cat :: dogsis aList[Animal]with nothing expected. An expected type decides it first; an invariant or contravariant use decides it for good. Two classes with no common superclass join to the one trait they share that every other trait they share is a parent of; sharing several unrelated traits is no join, an error naming them, rather than a choice among them. The same holds for branches. - Settled 2026-11-03: the names an
ispattern binds are in scope where its test is known to have matched: thethenbranch of anif, the body of awhile, the right operand of&&, and foris nottheelsebranches and the right operand of||, with!swapping the two. After anifwhose one branch never finishes, the rest of the block sees the other branch’s names.a is P(v) || b is P(v)binds novfor the whole. A condition binds a name once, and its names may shadow the enclosing block’s. - Settled by the user 2026-11-09: data updates are written
with { … }with field paths (Changing fields):p with { pos.x = 3, name = "a" }is a new value ofp‘s type, each named field replaced and every other onep‘s; a path rebuilds only the values along it, a shared prefix once. Paths go through data fields only; a method is never named; a path named twice, or a field beside a path inside it, is an error; an index is a syntax error suggesting the whole field; values are read against the leaf field’s type; the base is evaluated first, then the values left to right; an unknown field is reported with the nearest one.withis a keyword only after an operand and before{, binding as a postfix tail. - Settled by the user 2026-11-09 (“union types are great”): limited union types
(union types). (1) A union
A | Bis written only in annotations: parameters, results,vals, fields, type arguments and aliases (type Num = int | long). (2) It is never inferred: the branches of anifor amatchjoin as before. (3) It compiles to an anonymous tagged sum. (4)matchtakes it apart by type pattern, exhaustively: a member left uncovered is an error, and_is allowed. (5)?combines distinct error types into a union: a function returningResult[T, IoError | ParseError]may?aResult[_, IoError]and aResult[_, ParseError]. Intersection types stay deferred. The further rules are under Proposed.
Project and tooling
- A project lists packages; a package has an
avin.hoconmanifest; a module is a directory. - A program’s root is a directory, and each directory under it is a module named by its path from
the root (
a/bisa.b). The root directory’s own files are the root module, which has no name and holdsmain; they take no header. Every other file begins withmodule a.b, naming the module its directory makes it part of. A program of one file is compiled alone, and its header, if any, names its module. - A module’s files share one namespace: what one declares, every other sees by its bare name, its
privatedeclarations included. Another module’s declarations are reached only by importing them, per file:import a.b.X,import a.b.{X, y as z}. There is no wildcard import. An unknown import, an import of a private declaration and an import of a name the file’s module declares or another import already binds are errors; an unused import is not. - A file sees its own module’s declarations, then its imports, then the standard library’s public
declarations in module
avin, which need no import; the nearer hides the farther. Program modules may not beavinor under it. - Modules may import one another in a cycle; module-level values initialize in the order their uses need across the whole program.
- A class and its companion object are in one module, in any of its files.
- One
avincommand does everything: build, run, test, deps and config. - Testing is built in:
@test,@tests, setup and teardown, and the built-in runner. Every feature ships with tests. avin build file.avinwrites./fileby default;-ooverrides it. A failed build leaves existing output untouched.- The collector is Sysl’s
sh.sysl.gc, shared with Slate. Its API may change if Slate changes with it. - The compiler’s untyped AST, typed HIR, lowered IR and LLVM output are kept as distinct stages.
- A class and its companion object use each other’s private members, in both directions.
- An initializer’s dependencies count every lambda it makes as if it were called, and every function it calls in full, whatever branch is taken, so a cycle that no run could follow is still rejected.
- Settled on the user’s delegation 2026-11-15 (built on branch
concrete-impls; replaces the earlier rule that an impl covers every instance of its type): An impl of a trait may be for an instance of a generic data type or class,impl FromPg for Vector[byte], or for a partly applied one,impl[K] Show for Map[K, int]orimpl[T] Show for Box[Option[T]], since the rule for the concrete case covers those unchanged: the type conforms where it is such an instance, its parts matched exactly (no variance: aVector[Nothing]is not aVector[byte]here) and seen through its superclasses, the impl’s parameters taking the parts and then held to their bounds. Its members, static ones included, are the type’s at those instances, found by every path that finds an impl: a call on the value or the type, a call through a bound, a bound held where a type argument is written, a trait value and its method table, a type pattern on anAny, and a template walking a field of that type; a member of the type’s own of the same parameter types is hidden there. The impl belongs in the module of the type or of the trait, as any impl of a trait does (the core library’sVectortakes one in the trait’s module). No overlap: two impls of one trait may not both hold of any instance, so an instance impl beside the type’s own impl of the trait is allowed only where the instance misses that impl’s bounds (byteis noFromPg), and two instance impls only where no instance matches both; there is no specialization, no “more specific wins”. A missed bound keeps the two apart only if it is missed for good: where a module other than the impl’s own and the core library could still write the impl meeting it, one that names both the bound and the type without importing a module that imports it, the two overlap and the diagnostic names that module. A parameter of a partly applied instance may be any type, so it meets every bound.Eq,Hash,SendableandBoundaryare a type’s at every instance alike and take no instance impl. An instance impl ofDisplayorDebugfor a data type is an impl of the trait of its own, so the type has no automatic one at its other instances, as with any impl of the trait. Why: a PostgreSQL client needsbyteaasVector[byte]beside a generic impl for arrays, and every domain with a byte string, a matrix of reals or a map of strings meets the same need; refusing overlap keeps a conformance one answer everywhere, decided where the impls are written. Alternatives weighed: specialization, the most specific impl winning (complex, with unsound corners where a generic body relies on the general impl); a library byte-string type forbytea(does not help the next domain); leaving it (forcesbyteathroughbyte: FromPg, element by element). Review with the user: whether the core library should stay fixed in the overlap rule (it could in principle add a conformance later, but it changes with the compiler), and whether a module of the instance’s arguments should also be allowed to declare such an impl. - The singleton declaration keeps the keyword
object. - A program’s binding shims are one Sysl package that depends on the runtime’s, built into one archive the program links in place of the runtime’s, so all of a program’s Sysl code shares one copy of Sysl’s library. The archive is cached by a hash of the shims, the Sysl version and the runtime’s source.
- A binding is a top-level function. Across the boundary a
boolis a byte and acharits code point;stringandArray[byte]are copied each way. - A data type mirrors a Sysl enum or struct with
@sysl("module.Name")on its declaration. An enum’s variants are matched by name and their fields by position; a struct is mirrored by one variant named as the type, whose fields are matched by name. A mirror has no type parameters and never holds itself. An integer field takes any Sysl integer, converted with a check in each direction, so a Syslusizeis mirrored by along. - Settled by the user 2026-11-03: Sysl collections cross the binding boundary as copies. A Sysl
slice or
Bufof a boundary type in a result becomes a fresh AvinVector[T](or a freshArray[T], where the binding declares one); an AvinArray[T]orVector[T]parameter of a boundary type is copied into a Sysl slice. Collections nest, inside one another,Option,Resultand mirrors’ fields.Array[byte]stays a bulk copy to and from[]u8. No other Avin collection crosses. - Settled by the user 2026-11-04: A Sysl function may fill an Avin array (Sysl
bindings). An
Arrayofbyte, an integer type,real,boolorcharthat is a binding’s own parameter (a handle method’s too) is copied into a[]Tthe Sysl function may write, and copied back into the array element by element when it returns; the shim keeps the array as a root of the thread’s stack from before the call until the copy back, which runs after the result is made. The representation is a copy, not a view of the array’s own elements: the collector never moves an object, but a Sysl slice of memory it does not own has no owner, so a Sysl function that kept it would read freed memory once the call returned; a copy keeps Avin memory out of Sysl. Every other array crossing into Sysl (of other elements, or inside anOption, aResult, a collection or a mirror’s field) goes in as a[]const T, so a Sysl type that could write into it is refused at the binding instead of silently losing the writes. AVectorstays a[]Tcopy: it never changes, so nothing is lost. Option[+T]andResult[+T, +E]aredatatypes of the core library, written in Avin, with their methods in animpl. See errors.- Settled by the user 2026-11-04 (“follow the reference library”):
Option,EitherandResulttake lower bounds where the reference library’s methods have them, so a value taken in may be wider than the one held and the result widens to it:getOrElse[B >: T](default: -> B) -> B,orElse[B >: T](other: -> Option[B]),contains[T1 >: T](x: T1)andzip[T1 >: T, U](other: Option[U]) -> Option[(T1, U)]onOption;getOrElse[R1 >: R],orElse[L1 >: L, R1 >: R],contains[R1 >: R],flatMap[L1 >: L, R2]andfilterOrElse[L1 >: L]onEither;getOrElse[U >: T],flatMap[U, F >: E]andorElse[U >: T, F]onResult. On anOption[Cat],getOrElse(dog)is anAnimal. This replaces the earlier reading that the impl’s parameters, not being variance positions, needed no bound: they still are not, but only a lower bound widens the result.==compares a value of a type parameter with one of a parameter it is the lower bound of.joinLeftandjoinRightkeep their shapes,Either[Either[C, R], R]andEither[L, Either[L, C]], since a method takes one lower bound per parameter and the reference’s evidence form has no counterpart. - Settled by the user 2026-11-04 (“follow the reference library”): an unknown type argument still
open at the end of its body, that the call’s parameters and result name only where a value is read
out, is
Nothing:Nonealone is anOption[Nothing],Left(1)anEither[int, Nothing],Ok(1)aResult[int, Nothing],[]andVector.empty()aVector[Nothing]. A later use in the body still settles it first. A covariantNothingargument is any type, a value type’s too, since no value has it: anOption[Nothing]is anOption[int], in a declared type, an argument and a type pattern. An unknown named anywhere else (an invariant or contravariant argument, a lambda’s parameter) or nowhere stays an error asking for the type:Buffer(),Map.empty(),{}. ABuffer[Nothing]could hold nothing, and a module’sval b = Buffer()would only fail later, at the first store, so the error stays where the type is missing. - Settled by the user 2026-11-04: the core library has
Either[+L, +R], withLeft(value)andRight(value), because the reference library has it. It follows that library’sEitherin names and meaning and is right-biased:isLeft,isRight,fold,swap,map,flatMap,getOrElse,orElse,contains,exists,forall,filterOrElse,toOption,toList,toVector,foreach,iterator;mergeonEither[A, A],joinLeftandjoinRighton the nested shapes;Either.cond(test, right, left).OptiongainstoRight(left)andtoLeft(right). Defaults are by name and take lower bounds asOption‘s do (above). There is no left projection (swapserves), no?on anEither, and no conversion betweenEitherandResult, which stays the type for failure. See errors. ?returns from the function or lambda it is written in, so that one’s result type must be declared or, for a lambda, known where it is written, at least in shape (anOption, or aResultwith its error type known; see thelambda-question-shapeentry). It cannot leave a delayed argument or a class body.- Builders are the trait
Builder[-A, +C](addOne,addAll,result, and, as the reference library’s,clear, which every builder defines and which readies a spent one for a new collection,sizeHint, a hint that changes no result, andknownSize, -1 where a builder does not know it cheaply); a collection’s companion object makes one withnewBuilder[T]()(the reference library’s names, user 2026-11-04), and a sequence literal is built through the expected collection’s, so a program’s own class with such a companion is written as a literal too. AListliteral is built from the back with::, sinceListis a data type. - A collection literal compared with
==,!=or an ordering takes the other operand’s type. - A trap inside the core library, a
failor a failed check such as an overflow alike, reports the place where the program last entered the library: the program’s own call, however many library calls deep the trap is and whether the program reached the library directly, through a method table or through a function value. No annotation asks for it and no function of the program pays for it. See errors.
Settled by the user on 2026-11-03:
- A mirror’s fields are written in Avin’s lowerCamelCase; the compiler matches each to the Sysl field of the same words in snake_case.
fail(message)is public in the prelude: it traps with the message at the caller’s place and has typeNothing.- The methods an
impladds to a final class whose fields are all immutable are not variance positions, as adatatype’s are not: such an instance holds nothing a method could store a value into. A class with avarfield keeps every method a position, and so does anopenorabstractclass (settled 2026-11-05, below). - A one-variant
datatype may have a companionobject, as a class may: the name in call position is the constructor andName.memberthe companion (Map.empty,Map.newBuilder,List.newBuilder). - An
implmay add methods for some type arguments only:impl[T: Display] List[T]givesmkStringto lists of displayable elements, and calling it on any other list is an error. - The integers are one family: a closed core trait
Integer, whose members the compiler decides (everyiN), lets the core library implement a trait once for every width (impl[T: Integer] Display for T). Such an impl over a bare type parameter is allowed only for closed core traits, in the core library. - Settled by the user 2026-11-03: any run of the operator characters
+ - * / % < > = ! & | ^ ~ : ?that is not one of the language’s operators names a method, declared like any method and called infix (xs ++ ys) or dotted (xs.++(ys)). The language’s operators, including the yielding compound forms, are not method names: a type has them through their traits, and a method named+is an error saying to implementAdd. A symbol call groups left, except that a name ending in:groups right with its receiver on the right (x +: xsisxs.+:(x),xevaluated first). The level it binds at, and the bitwise operators a type may define, are settled on 2026-11-04. There are no prefix or postfix symbol methods;++and--update when no operand follows on the line.x op= ycalls the methodop=wherex‘s type has one, and otherwise is the language’s compound assignment or, for a symbol methodop,x = x op y. The library uses symbols:Vector‘s++,:+and+:,List‘s andMap‘s++, and a buffer’s+=and++=besideaddOneandaddAll. - A module may be named in code through an import of the module itself:
import a.b, thenb.Xreachesa.b‘s publicX, alongside imports of single declarations. - An infix method call binds more loosely than arithmetic, bitwise, shift, cons and range operators
and more tightly than comparisons,
is,&&and||, and groups to the left, soxs contains x && okis(xs contains x) && ok. - A literal pattern does not match an
Any(5 -> …on anAnyis an error);n: int if n == 5says it. - A tuple’s type at run time is the type it was made with:
(animal, 1)withanimal: Animalis an(Animal, int)whatever its class, and a type pattern(Dog, int)does not match it. - After its own last field, an
openorabstractclass’s body may call a private method that is safe: it usesselfonly to read and assign fields and to call other safe methods. - A string’s byte offsets and lengths are
int, and a string holds at most the largestintbytes. - A trait’s
overridemay give an abstract method of a trait it requires a body, not only replace a default. - An iterator is
hasNext()andnext(), andnext()on an exhausted iterator traps. - A
forwithoutyieldtraverses its source throughiterator()(a range written in place is counted and an array indexed);break,continueandreturnleave the body directly. A type withforeachand no iterator is not aforsource. Array.fill(n, value)evaluatesvalueonce and shares it between the elements; per-element values come fromArray.tabulate.- The hash-based maps and sets iterate in an order the program cannot rely on: the immutable ones in an order fixed by the keys’ hashes alone, so equal maps iterate alike, and the mutable ones in table order.
- Maps and sets display in the shape of their literals:
{a: 1, b: 2},{1, 2, 3}, and{"a": 1}with each part’sDebug. Mutable maps and sets compare and hash by contents, as arrays do. - Every
datatype may have a companion, not only one-variant ones: anobjectnamed after a data type of its module is its companion. A variant of the type’s own name stays the constructor in call position; a type with no such variant (List) has nothing of its name to call. An object cannot share its name with a variant of another type, nor with a fieldless variant of its own type’s name. - A collection literal builds whatever collection is expected through the type’s own conformance to
the core trait
Buildable(the entry of 2026-11-19 on branchbuilder-trait): a sequence literal a sequence, a set literal{a, b}a set and a map literal{k: v}a map, giving the builder each entry as a(key, value)pair; with no expected collection they are aVector, aSetand aMap. - The arithmetic traits carry their identities:
AddhaszeroandMulhasone, sosumandproductof an empty collection are those values rather than anOption. They are written once, by impls onIterable(impl[T: Add] Iterable[T],impl[T: Mul] Iterable[T]). Seq[+T]is a core trait overIterable[T]with two abstract methods,length()andapply(index); its other methods (lift,isEmpty,head,headOption,last,lastOption, the folds,foreach,exists,forall,find,indexWhere,count,toVector,toList, an iterator andreverseIterator) are default bodies written once over those two.head,headOption,lastandlastOptionareIterable‘s own, written overiterator()for every collection (user, 2026-11-04, as the reference library has them), and a sequence and a sorted collection override them to reach the end at once.lift(i)is the element as anOption.Listis aSeqand overrides every one that would index into it, so none takes more than linear time on a list.containsandindexOf, which take an element, andmkString,maxandmin, which need something of the elements, are added toSeqby impls (impl[T] Seq[T],impl[T: Display] Seq[T],impl[T: Ord] Seq[T]), written once for every sequence;containsandindexOfareexistsandindexWhere, so on a list they walk it once.- A sequence pattern on a sequence other than a list asks
length()once and then reads, withapply, each element whose pattern is not_, in order, stopping at the first that fails. Deque[T]is a ring over an array, doubling when full as a buffer does, its spare places zero bytes.removeHead()andremoveLast()return the element and trap on an empty deque, asBuffer.removetraps outside the buffer;isEmpty()is the test before them. Settled 2026-11-04 by the user: a buffer and a deque take the reference library’s names for adding,addOne,append,prepend,addAll,appendAll,prependAll,insertandinsertAll, and a deque’s ends areprepend,append,removeHeadandremoveLast.- A trait may declare
staticmembers, which belong to the implementing type rather than to a value:static zero() -> SelfinAdd,static one() -> SelfinMul. Every impl gives them, and they are called on a type,int.zero(), or on a bounded type parameter,T.zero().sum()andproduct()on the collections are written with them. The details of static members:staticis a keyword, written afterprivateand before or afteroverride; a static member is a trait’s, an implementation of one, or a built-in type’s own (below), and a class ordatatype keeps what belongs to the type in its companion object; in a trait it has no default body, and no trait overrides one; an implementation isstaticexactly where the trait’s member is, an abstract class giving it too; its body has noself; a trait’s default body cannot call one onSelf; a trait with one is a bound and not a type; and a local, parameter, member or module value of a type’s name hides the type as a receiver. - Settled by the user 2026-11-04: a built-in type declares
static members of its own, as
staticmembers of an impl of the type without a trait (impl stringwithstatic fromUtf8(bytes: Array[byte]) -> Result[string, Utf8Error]), forstring,char,bool,real,byteand each integer type, since a built-in type has no companion object. The core library declares the built-in types’ own; a program adds them in an extension, as it adds methods, seen where the module is imported and private to it where marked so. They are called on the type’s name, never on a value, and their bodies have noself. A name is a static member or a method of the type’s values, never both; static members of one name overload by parameter types;wrapand the numeric limits (MaxValue,MinValue,real‘sNaNand the rest) are the language’s and cannot be redeclared. A generic impl, an impl adding to a trait and an impl of a class ordatatype declare no static member of their own. Any static member named on a known type without a call (string.fromUtf8Lossy,int.zero,Point.zero) is a function value of its parameters; an overloaded one takes the expected function type’s overload, and without one is an error. The first use isstring.fromUtf8andstring.fromUtf8Lossy(strings from bytes), bound to Sysl’s UTF-8 decoders, withUtf8Error(offset: long, truncated: bool)mirroring Sysl’s error. i1has no1:i1.one()is a compile error, andone()reached ati1through a generic traps with “i1 has no 1” at the place the program called, so a generic that passes its bounds compiles for every type meeting them.- An
implmay add methods to a trait (impl[T] Seq[T],impl[T: Display] Seq[T]). Its methods reach the value only through the trait’s own methods, which are variance-checked, so, like the methods an impl adds to adatatype, they are not variance positions:contains(element: T),indexOf,mkString,maxandminare written once onSeq, and generic code overSeq[T]has them. A call is compiled for the receiver’s static type, so the trait’s methods the added one calls are that type’s, called directly, and go through the method table only where the receiver is seen as the trait. Lookup takes the receiver’s type’s own methods first: an added method with the name and parameter types of one the type has is passed over, so a type keeps a faster version of its own where its static type is known. Two impls of different traits adding a method of one name and parameter types to a type conforming to both make a call of it on that type an error; an impl may not add a method the trait declares. - The form of a
forwithyield(for comprehensions): generatorspattern in sourceseparated by commas, each followed by any number ofifguards, thenyieldand the value on the rest of the line or in an indented block; or the generators one to a line in a block afterfor, a line starting withifguarding the generator above, withyieldon the line after the block.yieldis a keyword. Aforwithoutyieldonce kept one generator and no guards; the entry on loops of several generators below replaces that. - Settled on the user’s delegation 2026-11-19: a
forwithoutyieldtakes every clause a comprehension takes (several generators,ifguards after each, value definitions between them) and runs as the loops they nest into (branchfor-forms). The parser writes it out: each generator aforinside the one before, each guard anifaround the rest, each definition avalbefore the rest; sobreakandcontinueact on the innermost generator’s loop andreturnleaves the function, exactly as the hand-nested form does, and each generator is counted, indexed or iterated as a loop of its own (no allocation over ranges and arrays). Why: porting numeric programs hit the one-generator rule five times in four programs, each time with an obvious meaning; the nested form is the one reading that adds no new semantics. Avin has no loop labels, so abreakout of every generator is areturnfrom a local function or a flag, as for hand-nested loops. Alternatives: keep the rule (pushes the nesting onto every grid and pair loop);breakleaving the wholefor(a meaning the nested form cannot show, and acontinuewould then want the same, making the two forms differ); a loop over a lazy product (allocates, and loses per-generator counting). The one-to-a-line block form afterforstays a comprehension’s:doon the line after the block would read as ado … whilestatement. Review with the user: it reverses a settled rule, andbreakacting on the innermost generator only is the choice to look at. - Settled on the user’s delegation 2026-11-19:
yieldmay start a line indented under a one-linefor‘s clauses (branchfor-forms), with its value on the rest of the line or in a block under it; nothing else may follow it inside that indentation. Why: a function body whose comprehension’s header fills the line wants itsyieldbelow it, as a continuation line holds an operator below its expression.dois not accepted there, since an indented line starting withdois already ado … whilestatement in a loop’s body, and an indented body needs nodo. Alternatives: the block form only (for+ clauses one to a line +yieldatfor‘s depth, which reads poorly for one generator); a general rule continuing any keyword-led line (wider than the need, and ambiguous with bodies). - A guard is
withFilter, a lazy view each collection provides; on a source that is noIterableit isFilter‘sfilter(see the entry on comprehensions by conformance).flatMapon the library’s collections takes anyIterablefrom its function, or anOption(see the entry onflatMapwith options, branchmap-flatmap); aRangemaps to aVector; aMap‘s entries reach a comprehension as pairs, throughmapandflatMapoverloads taking a function of one pair, and yield aMapwhere they yield pairs, a collection otherwise. - A generator’s pattern must match every element, as in a
forloop, rather than filtering out the elements it does not match.return,break,continueand?cannot leave a comprehension’s guards or yielded value.
Settled by the user on 2026-11-04:
-
From[E]is one generic trait, implemented once per source error type by the type the errors convert to:impl From[IoError] for ConfigErrorbesideimpl From[ParseError] for ConfigError. A type may implement one generic trait at several type arguments where the trait’s members are all static and it requires no other trait, asFrom‘s one member,static from(value: E) -> Self, is; any other trait is implemented once.?on aResult[U, E]in a function yieldingResult[T, F]passes the error on unchanged whereEis anF, and otherwise throughF.from: atFrom[E], or else at the one conformanceFrom[X]withEanXthat is more specific than every other such. Neither is an error namingFrom[E]; several equally specific ones are an error naming them. On a type parameter the conformances are its bounds’,F: From[IoError] & From[ParseError]. See errors and declarations. -
One formatting style, applied by
avin fmt [--check] [<path>...]and the language server’stextDocument/formatting. Each block level is indented two spaces; a literate file keeps its four-column code-block margin and indents two a level inside it, and only its program is formatted. Spaces go around binary operators (ranges included,0 ..< n),=and->, after,and:, and nowhere inside brackets; a prefix operator stays against its operand. At most one blank line in a row, none at either end of the file, and one between two top-level declarations unless both are one line; a declaration’s comments and annotations stay with it, and a function’s clauses are one declaration with its signature, no blank line among them (Proposed, under Proposed). Comments are kept exactly, a trailing one a space after the code. A line longer than 120 characters has a list broken one item per line, a call’s or a literal’s items two columns in and a parameter list’s four, the closing bracket on its own line; a list the source wrote one item per line stays so, except that a broken sequence or set literal of short, simple items is filled as many to a line as fit (Proposed, under Proposed); a binding’s value with no list to break is broken before its loosest operators as continuation lines, though only after the lastthen,eliforelseof a one-lineif(a line after anif‘s test is its block, so a test and an earlier branch stay whole). No trailing commas are added. The formatter keeps every token and refuses a file that does not parse; its result parses to the same syntax tree. -
compareAndSeton a value without identity — a data value, tuple, string,OptionorAny— compares with==; on scalars and references it compares the word. A class instance (even of a class that derivesEq) and a function value keep identity. See threads. -
Vector[+T]is a persistent, radix-balanced tree of arrays of 32, with a prefix and a suffix beside a balanced middle at every level, and stays the default sequence ([1, 2],[]T,main(args)). Indexing andupdatedtake one array per level, at most six;:+and+:take amortized constant time; slicing,take,dropand their kin take time in the depth and share every array they do not cut;++takes time in the shorter operand. A vector’s arrays are exactly sized and never written once they are in a tree. The one-array immutable sequence remains asArraySeq[+T], for elements built once and then read, with no level between an index and its element; every changedArraySeqis a copy. Every collection hastoArraySeq(). See collections. -
An impl that only adds methods may be written in any module (a relaxed impl); in another module than its type’s or trait’s it is an extension:
impl string,impl[T: Ord] Seq[T],impl[T] Option[Option[T]],impl Boxfor another module’s class. Its methods are seen in its own module and in every file importing that module, whole or any declaration of it, with no further step; a file importing neither does not see them, and the core library’s are seen everywhere. A type’s own methods are found first: an extension method a type’s own or inherited method of the same name and parameter types always hides is an error at its declaration, and one added to a trait is passed over for a type that has such a method. Two seen extensions of different modules adding one name and parameter types to a receiver make the call an error naming both modules. An extension’sprivatemethods are private to its module. Its methods reach no private member of another module’s type, are in no method table and are not overridden;selfis the receiver and the type’s public fields and methods are in scope by bare name. Infix calls, method values and calls through a bound see extensions as dotted calls do, a bound’s where the generic function is written. Conformances,impl Trait for Type, stay in the module of the type or of the trait. -
Sequences, sets and maps are functions, by subtyping.
Seq[+T]is a subtype of(int) -> T, through itsapply(index);Set[A], immutable and mutable, of(A) -> bool;Map[K, V], immutable and mutable, of(K) -> V, whoseapplytraps on a missing key asm(k)does. A collection is passed, stored and called where its function type is expected with no conversion, and variance holds through it: aVector[Dog]is an(int) -> Animal. For a sets,s(x)is legal:truewhenxis an element ofsandfalseotherwise, the set’sapply(x) -> bool, which iscontains. -
A class or trait names a function type among its parents after
:(trait Seq[+T]: Iterable[T], (int) -> T), and a data type or class through an impl with no bounds of its own (impl[K, V] (K) -> V for Map[K, V]), in the type’s own module. The type then has anapplytaking exactly that type’s parameters and yielding its result or a subtype;applyimplements no trait method, so it is not markedoverridefor it. A type is at most one function type, counting those of its superclass and its traits, and its parameters keep their variance there. A built-in type is no function. -
A function type with one parameter is written without parentheses:
int -> string,Option[T] -> bool.->in a type groups to the right, soint -> int -> intisint -> (int -> int);(A) -> Bis the same type asA -> B,(A, B) -> Ctakes two parameters, a function taking one tuple is((A, B)) -> C, and a function taking a function is(int -> int) -> int. A function type needs no parentheses in a parameter, field, result, type argument, tuple part orvalannotation, nor as a supertype; a type pattern in amatcharm still writes it in parentheses, since the arm’s own->follows it. Error messages print every function type with a parameter list,(int) -> int. -
mainismain()ormain(args: Vector[string]), the arguments after the program’s name, the same asavin.process.args(). The parameter is exactlyVector[string](a name for that type is the same type;Seq[string]andArray[string]are errors), it has no default, and any other parameter list is an error naming the two forms. The result rules are unchanged. A program built for its tests does not runmain, so tests see no arguments. -
A
matchwith nothing before it is a function literal of one value, whose arms are ordinarymatcharms:xs.collect(match Some(n) -> n), one arm on thematchline, or an indented block of them, inside parentheses or after an infix method’s name. Its parameter type comes from the expected type, as a lambda’s does, and with none it is an error. WhereA -> Bis expected its arms must cover everyA; wherePartialFunction[A, B]is expected they need not.PartialFunction[-A, +B]is a core-library trait withisDefinedAt, a call that traps at the program’s call site outside its domain,lift,orElseandapplyOrElse; a literal tests its patterns and guards once per call,liftorapplyOrElse. Every collection withmaphascollect, everyIterablehascollectFirst, andOptionhascollect. APartialFunction[A, B]is a subtype ofA -> B, through itsapply, so it passes wherever one is expected and traps there outside its domain. -
[]Tin a type position means exactlyVector[T]:xs: []int,[][]int,Option[[]string],main(args: []string). Its element is a name or a parenthesized type, so[]int -> intis a function from a vector and[](int -> int)a vector of functions. A type pattern takes it without parentheses,v: []int -> body. There is no fixed-length[N]T(an error); error messages printVector[int]. -
The thread model (threads):
avin.threads.spawn(body)starts a closure on a new thread with an 8 MiB stack andjoin()gives back its result; a structuredscopejoins every thread started in it; a trap in any thread stops the program, and the program ends whenmainreturns. The heap, module-level values and capturedvars are shared. The library offersMutex[T]owning its value,Condition, sequentially consistentAtomic[T],Channel[T]andOnce, and every wait marks its thread safe for the collector. A data race is not undefined behaviour: heap fields and module-level variables are accessed with LLVM’sunorderedordering, so a racing read sees some value written to that word, and a constructor ends with a release fence, so no thread sees an object without its header and constructor-set fields. Actors are scheduled onto a pool of these threads. -
Details of starting and joining:
spawngives back aThread[T]whosejoin()any thread may call, any number of times and at once; one waits for the thread and the others for that wait. A thread’s handle is collected like any object once nothing reaches it; a thread never joined keeps its stack until the program ends.s.spawnis called by the thread running the scope’s body while the scope is open, and anything else traps, so the scope sees every thread it has to join; a thread the scope started starts more through a scope of its own. When several threads trap at once, or one traps while another callsexit, only the first stops the program: its output is flushed once and its reason is the one reported. -
Repeated parameters:
values: T*is the last parameter, at most one, named, with no default and not by-name; inside the function it is aVector[T]. A call gives it every positional argument from its position on, each checked againstT(so genericTis inferred from them), or splices oneIterable[T]withxs*as its only argument, written last: aVector[T]is passed as it is, any other sequence copied.f(1, xs*)into the one parameter,xs*anywhere else, and naming the repeated parameter are errors. A function with one, used as a value, has the type(…, Vector[T]) -> R. A method overriding or implementing another repeats the same parameter or neither does;maintakes none;datafields cannot be repeated. A method whose only required parameter precedes a repeated one is called infix with one argument. -
An impl without
foradds methods to any type built from its parameters (declarations):impl[T] Option[Option[T]],impl[A, B] Pair[A, List[B]],impl[T] Seq[Seq[T]],impl[K, V] Iterable[(K, V)]. Every parameter must appear in the type. A call matches the receiver’s static type against it, seeing a reference through its traits and superclasses only at covariant parts, and holds the learned parameters to the impl’s bounds; a receiver that does not match is an error saying what it would need to be. Two impls that both match a receiver and add a method of one name and parameter types make the call an error, as does such a method clashing with the type’s own. An impl of a trait for such a type is an impl for instances of it, whose overlap with another impl of the trait is an error (see the impl for instances of a generic type, 2026-11-15). The core library addsflattentoOption[Option[T]],Result[Result[T, E], E]andSeq[Seq[T]](aVector[T]),toMap()toIterable[(K, V)](keys bounded as a map’s) andunzip()toSeq[(A, B)]. -
A heap field or module variable wider than 64 bits is accessed as untorn 64-bit words: a racing read of it may combine words of different writes (threads).
-
Details of synchronization:
Mutex[T].withhands its body the value itself, and an immutable value is read withget, replaced withsetand changed withupdate(f)under the lock. A mutex is not reentrant, and a thread taking one it already holds traps rather than waiting for ever; otherwise only a deadlock of the whole program is detected (diagnostics). AConditionis made by its mutex’scondition(), so it is waited for with that mutex only, andwait()from a thread not holding it traps.Atomic[T]holds any type: a value of one word lock-free, an integer wider than 64 bits under one runtime lock;compareAndSetcompares identity for a reference and the bits for a real;addandsubgive back the new value and trap on overflow before storing, andupdate(f)retriesfuntil its compare-and-set succeeds.Channel[T](capacity = unbounded)is unbounded with no capacity, a rendezvous at zero (Proposed below, which replaced unbounded at zero), and a negative capacity traps; a send to a closed channel traps, closing twice does nothing, and a channel isIterable, receiving until it is closed and drained.Once.runmakes every other caller wait for the running body; a body running its ownOnceagain traps. -
Trailing blocks: an indented block on the lines after a call is the call’s last argument, given to the callee’s last parameter. A by-name parameter takes the block as its delayed expression (
retry(3)+ block); a function parameter takes a lambda whose parameters end the call’s line, one name or a parenthesized list after the call’s parentheses (withFile(path) f ->,zipWith(a, b) (x, y) ->). A callee with no other arguments is written without parentheses (scope s ->,s.spawn+ block). It applies wherever an expression ends a line (val r = retry(3)+ block, a method call, a match arm’s body), and never in the test ofif,elif,whileordo … while, aforsource or guard, or a class’s parents, where the block is the form’s body. A local function’s header keeps its meaning:name()orname(x: T)before a block declares one. A block whose only line is a name and an operand stays the infix-continuation error. A block for a last parameter that is neither by-name nor a function, already given, or absent is an error. -
Futures in
avin.threads:Future(body), the companion’sapply[T](body: -> T), runs a by-name body on a shared pool and gives back aFuture[T]at once;await()waits safe for the collector,await(timeoutMillis: long)gives anOption, and times are milliseconds as along, as in a condition’swaitFor(timeoutMillis) -> bool.map,flatMap,zip,onComplete,Future.all(aVectorin the order given),Future.first(trapping on no futures) andFuture.successfulnever wait, and every function given to one runs on a pool thread. A future carries no failure: a computation that can fail is aFuture[Result[T, E]], which also hasmapOkandflatMapOk, and a trap in a body stops the program.Promise[T]()has afuturefield;complete(x)a second time traps, andtryComplete(x) -> boolcompletes only where nothing has. The pool starts workers as work comes, up to one per processor (sysl.platform.cpu_count), never joins them, and starts one more in the place of each worker waiting inawaitwhile work is queued, so nested waits never deadlock it;awaitinside a body is allowed. The pool is a module’slazy val, so a program that makes no future never makes it. -
lazy val, at module level and in class and object bodies (each instance its own), and in blocks (each declaration’s run its own, see the entry for branchlazy-local), is computed on its first read, exactly once, and kept; never read, never computed.lazyis a modifier only beforeval, an ordinary name elsewhere;lazy varandlazyon parameters, class parameters and data fields are errors. A module-level one takes no place in the eager initialization order, its readers depending on what its initializer reads; an initializer whose own code needs its own value, directly, through the functions it calls or through other lazy values, is a compile error naming the chain (module-level, field and local ones alike; see the initialization entries), and one that reaches it through a function it hands on traps at that read, naming the value. A field’s initializer may use every field and method; the class body reads the field only where it could call a method. Concurrent first reads run the initializer once, the others waiting safe for the collector; the value is published with a release store paired with the readers’ acquire load, a stored value read with one atomic load and a branch. -
A companion’s
applyoverloads the constructor its name has in call position. Where an object declaresapply,Name(…)chooses among the class’s constructor (or the data type’s variant of its name) and everyapplyby the ordinary static overloading rules: most specific by parameter types, with by-name parameters, defaults, repeated parameters, generic inference and trailing blocks as for any call (Future(fetch(url)),Future+ block). Type arguments written at the call are the chosen candidate’s: the class’s or data type’s for the constructor, the method’s for anapply. Anapplywith the constructor’s parameter types, up to type parameter names, is an error at its declaration. A name with no constructor in call position (a data type with no variant of its name, an abstract class, a plain object) calls itsapplyalone, and the library’sList,SetandMapcompanions take their elements that way:List(1, 2, 3),Set(…),Map((k, v), …). Where a function type is expected, the name is the constructor orapplythat type chooses, as for an overloaded function value; elsewhere the bare name stays the object. This amends the earlier rule that the name in call position is only the constructor and that an object cannot be called. -
A method named by a symbol binds at the level of the language’s operator its first character belongs to, on Avin’s own table, tightest first: a name starting with any character that starts no operator below (
~,?) binds above multiplication;*,/,%,<<and>>names with the multiplicative operators and shifts;+and-names with the additive operators;&,^and|names with those bitwise operators,&tightest;:names with::; then ranges and methods called by a word (a max b);<,>,=and!names with the comparisons; and a name ending in=that is not a comparison (+=,++=,|=) is an assignment. A name ending in:still groups right with its receiver on the right, and left- and right-grouping operators at one level, symbol, word or the language’s own, do not mix without parentheses (1 :: xs :+ 2is an error;1 +: xs :+ 2is(1 +: xs) :+ 2). Soxs ++ ys :+ zis(xs ++ ys) :+ z, and the combinatorsa ~ b ^^ f | c ~ dread((a ~ b) ^^ f) | (c ~ d).&,^,|and~between two operands are free method names for every type but the integers and bytes, whose bitwise operators stay the machine’s and cannot be redefined, by an extension either;a | bon such a type calls its method|, andx |= ycalls|=where the type has one and is otherwisex = x | y. Prefix~stays the integers’ and bytes’ complement.+ - * / %and the comparisons still come only through their traits, and&&,||,!,===,!==,::,=,:=,->,?,..and..<stay reserved. This replaces the earlier rule that every symbol call binds at the level ofa max b. See methods named by symbols. -
The shifts
<<and>>are free method names on the same terms as&,^and|(user, 2026-11-04), so a parser combinator library can spell sequencing-then-mapp >> f. On every type but the integers and bytes,a << banda >> bcall the methods of those names, at the shifts’ own level, that of multiplication (a ++ b >> fisa ++ (b >> f),a >> f | bis(a >> f) | b);x <<= ycalls<<=where the type has one and is otherwisex = x << y. The integers’ and bytes’ shifts stay the machine’s and cannot be redefined, by an extension either, and the yielding forms<<:=and>>:=stay reserved. Avin has no>>>operator, so>>>was already a free name. This amends the rule above. See methods named by symbols. -
The arithmetic operators
+ - * / %and the orderings< <= > >=are free method names on data types, classes and traits, with any operand and result types (user, 2026-11-04), beside the operator traits, which stay for generic code:Instant + Duration -> Instant,Instant - Instant -> Duration,Vec * real. Such methods overload by the operand’s type like any other.a + bcallsa‘s method+wherea‘s type (a data type, a class, or a type parameter through its bounds) has one taking one argument, at the built-in operator’s own precedence; where it has none, the operator is the core trait’s (Add‘sadd), as before. The method is just a method: on a type with both, the operator calls the method and code bounded byAddcallsadd. Prefix-acalls a method-taking no argument (-() -> Vec), and otherwise isNeg‘snegate.a < balone calls the method<, whatever it yields; a comparison by a method chains when every link yieldsbool(amended 2026-11-19; see “a comparison chain’s links may call operator methods” below, among the decisions settled on the user’s delegation).x += ycalls+=where the type has one and is otherwisex = x + y, the method+included. The built-in types keep their operators: a method of one of these names onint,real,byte,char,string,boolor a tuple, by an extension or a trait implementation, is an error.==and!=stayEq‘s, and the wrapping, saturating and yielding forms stay reserved.avin.timespells its reading arithmetic with them. This amends the two rules above. See methods named by symbols. -
notis a soft keyword: a keyword only directly afteris(user, 2026-11-04), so the parsing library can name its negative lookaheadnot(p). Afterisit is always the keyword, sox is not(y)negates the pattern(y); everywhere else it is an ordinary name, and a function, method, parameter or local may be callednot. See is. -
A method named by a symbol with
~anywhere in its name binds at the tightest symbol level, whatever its first character:~,~>,<~,~!,<~>and^~bind together there and group left, sonum | symbol("(") ~> expr <~ symbol(")")isnum | ((symbol("(") ~> expr) <~ symbol(")")),"[" ~> items <~ "]" ^^ fis(("[" ~> items) <~ "]") ^^ f, anda <~ b ~ cis(a <~ b) ~ c. Every other name keeps the first-character rule; a~name ending in=(~=) is still a compound assignment, and prefix~is unchanged. This amends the rule above, under which<~bound with the comparisons. -
A line that starts with a binary operator, indented deeper than the line where its expression began, continues that expression, with the operator’s own precedence: the line break means nothing. Every binary operator of the language, every method named by a symbol,
~, and++or--with an operand after it start one, and so does a member’s.(see the Proposed entry on.lines); a word,!,?, a bracket and the assignments do not. It applies wherever an expression with a complete operand ends a line (a binding’s value, an assignment, areturnvalue, an infix call’s argument, amatcharm’s or a lambda’s body, an expression statement) and ends at the first line back at the depth the expression began on; a line inside it that does not start with an operator is an error. Blank lines and comments between continuation lines are skipped. After an operand-xand+xthere are binary; after the test ofif,eliforwhile, aforsource, a class’s parents, and after anything that is not a complete operand (=,->,else,do, a signature), an indented line is a block’s line, soif cover-1is a block yielding-1. An indented line starting with an operator after a call is a continuation, not the call’s trailing block. See continuation lines. -
A
.lavinfile is literate source: a Markdown document whose lines indented four columns are the program, and the name alone decides it (an.avinfile never reads this way). It is accepted wherever an.avinfile is: a program of one file, a file of any module of a directory program or of the library,avin test, and the language server. The program’s own indentation starts after the four columns; prose between two blocks ends nothing and reads as blank lines; a fenced block (```or~~~) is an illustration and is not compiled; an indented block under a list item is prose. Prose is blanked, not removed, so every position reported is the document’s own line and column. A tab in a line’s indentation and a fence that is never closed are refused where they are.avin tangleprints the program with the prose stripped, line for line;avin weaverenders the document as one HTML page, the prose as GitHub-flavoured Markdown and the program coloured by the compiler’s own lexer. See literate source. -
Derivation through shapes (derivation):
derivestakes any trait whose module declares aderive X for Ttemplate, written once like an impl. Every data type and class (its constructor parameters) has a shape, made once beforemain: variants, fields, names, positions, defaults and annotations. Inside a template,T.walk(value, visitor)andT.walkPair(a, b, visitor)call the visitor’sfield[F: Bound]hook once per field at that field’s type, andT.build(builder)makes a value from fields supplied in any order, using defaults and the builder’smissingfor absent ones. The template is checked once; the visitor’s hook is found for each deriving type, and that each field meets its bound is reported at thederivesentry naming the field. Annotations are values of types implementingAnnotation, written@JsonKey("name")on a type, variant or field. The user resolved the proposal’s open questions:Shapedis a bound only a template’sThas; a program cannot write it elsewhere.- The built-in
Display,Debug,Ordand classEqandHashderivations are to be re-expressed as core-library templates. A data type’s own==and hash stay the language’s. - A misused annotation is not rejected while compiling; it fails when a value is decoded.
buildis refused for open and abstract classes, an error at thederivesentry;walkis allowed.- Every type parameter of a generic deriving type is bounded by the derived trait.
-
Packages beyond the manifest, settled by the user (2026-11-04) as proposed:
- Features (features), Sysl’s model with the module as the unit
gated: a feature block has
doc,default,modules,enablesandrequires, andname = [x]is its short form; optional dependencies,"dep:x","dep/feature", users’features,default_features = falseand-x, unification by union and the--features/--no-default-features/--all-featuresflags are Sysl’s. Where Sysl gates lines with#if feature_x, Avin has no conditional compilation: a feature lists whole modules (with those under them), read only while it is on, and an import of a gated module or of an optional dependency’s module is allowed only from a module whose own gate implies it, checked against the manifest whatever is selected, so features are additive by construction.avin test,avin check, the language server andavin tidyturn every feature on. Not carried over: Sysl’schoices, a feature’sifandtargets, and options, which are about machines and C configuration Avin’s manifest does not describe. - Members of a repository (members), Sysl’s:
{ git, member = "dir", version | rev }, the member a package named<coordinate>//<dir>for selection andavin.sum, every member at one version one clone whose hash each member’s line carries, a fetched member’sworkspace = trueand in-repositorypathsiblings read as their own coordinates at the member’s version, andavin add <coordinate>//<dir>@<version>. Its modules keep their own names, as every dependency’s do, so Avin needs nopackage.repositorykey. - Vendoring (vendoring), Sysl’s:
avin vendorcopies the resolution with every feature on intovendor/at the project (workspace) root in the cache’s layout, each copy hashed against itsavin.sumline first,.gitand path dependencies left out; avendor/present is the cache, and the root’svendor/is never a module. Two choices of Avin’s own: a package missing fromvendor/is refused rather than fetched into it, so a vendored build never touches the network; andavin vendorremoves packages the resolution no longer reads, asavin tidydoes for lines. - The standard library’s modules (standard library):
the
avintree shipped with the compiler (share/avin/library, orAVIN_ROOT/library), versioned with it, never a dependency and never inavin.sum;avinis the prelude, seen without an import, and every module under it is imported by name like any module. A compilation reads the prelude and then only the library modules something imports, transitively, so the library can grow without every program parsing all of it. Domain libraries are packages (as settled fordev.avinlang). The standard library has no features.
- Features (features), Sysl’s model with the module as the unit
gated: a feature block has
-
Integer limits and narrowing (user, 2026-11-04).
MinValueandMaxValueon every integer type (int.MaxValue,long.MinValue,i8.MaxValue, anyiN), onbyteand onchar, and onrealMaxValue,MinValue,MinPositiveValue,PositiveInfinity,NegativeInfinityandNaN, all compile-time constants. Narrowing integer conversions (i8(x),int(l),T(n), and a byte or char to a narrower integer) trap when the value does not fit; real-to-integer still saturates. The wrapping form,i8.wrap(x)(spelling proposed below), keeps the low bits. A type parameter bounded byIntegerhas the limits too,T.MaxValueandT.MinValue, each instance’s own (generics). -
Settled by the user 2026-11-04: Nested data types (generics): a data type naming itself at a larger instance in its fields (
Deeper(inner: Tree[Nest[T]])inTree[T]) is rejected at the type as polymorphic recursion, even where no code compares, hashes or shows it, since every data type’s structural equality, hash andDisplaywould need a copy for every depth. A class naming itself so in a field is not rejected for that alone; only code that grows with it is. -
Settled by the user 2026-11-04: Which growth counts (generics): growth is measured as nesting depth, and a cycle is rejected when a round of it nests its type arguments deeper in total. A call through a bound on a value of a type parameter takes that type’s arguments apart (a
Box[U]reachingBox‘s method atUis one level less); an implementation reached through a method table whose static type names every type parameter of the receiver’s class (anIterator[(A, int)]for anIndexedIterator[A]) takes them apart from the receiver’s, while one reached through a trait that leaves some unnamed (a trait with no type parameters) continues the cycle from wherever the class’s larger instance was made. -
Settled by the user 2026-11-04: Literal shapes (collections): each of the library’s collections is built only by the literal of its own shape: every
Seqby[a, b],Set,TreeSetand the mutableSetby{a, b}, andMap,TreeMapand the mutableMapby{k: v}, soval s: Set[int] = [1, 2]is an error naming the literal to write;{}is the empty set or the empty map, whichever is expected. A program’s own collection with a builder is built by any literal whose elements its builder takes, a map literal only by a builder of pairs. A map literal’s keys agree on one type and its values on another, each asifbranches do. The mutableSetandMapgain companions withemptyandnewBuilder. -
Settled by the user 2026-11-04: Packages (packages), modelled on Sysl’s package system:
- The manifest:
package { name, version, description },dependencies { … }andworkspace = [ … ], and no other key; an unknown key is an error, not a warning. A name is a lowercase letter then lowercase letters, digits,_and-; a version ismajor.minor.patchwith no leading zeros. A manifest is optional: a directory or file with none above it is a program as before. - Dependencies:
{ git = "host/owner/name", version = "x.y.z" }read at the tagvx.y.zand cloned fromhttps://;{ path = "../dir" }, relative to the manifest naming it, and in a fetched package naming another package of its repository at its version (refused when it leaves the repository);{ workspace = true }. A coordinate withhttps://or.gitis refused. Features and members of a repository are settled above. - Members, as built: a fetched package’s in-repository
pathandworkspace = truedependencies are read as the repository’s own packages at its version whether the package is a member or the repository’s root package, since the root of a workspace with apackageblock is its first member. A member’s directory may hold no.,..or*. The clone is filed once per repository and version; a repository whose root has no manifest is still filed when a member of it is what was asked for. - Vendoring, as built:
avin tidyandavin addread the machine’s cache, fetching into it, whether or not the project has avendor/, so a dependency is added to a vendored project and then copied in byavin vendor.avin vendorchecks every cache copy before writing anything, so a refusal leavesvendor/as it was (and a project with none still has none); a vendored copy is left alone only when its recorded hash and its files both match its line, so an edited copy is replaced; directories left empty by a removal are removed; and it endsvendored N packages into vendor/, the packages beingavin.sum‘s lines (a member and its repository’s root package at one version are two packages and one copy). The cache’s.hashbeside a vendored entry is trusted by a build, as the cache’s is: a build does not re-hashvendor/. revpins:{ git = "…", rev = "<hex>" }, seven to forty lowercase hexadecimal digits, refused with aversionor withoutgit. The repository is cloned whole and the commit resolved to its full id, fetched by that id when no branch or tag reaches it (only a full id can); the cache entry is@r<full id>and theavin.sumline<coordinate> r<full id> sha256:…, so an abbreviation and the full id are one package. A cached commit an abbreviation begins is found without the network. A package pinned at two commits, or at a commit and a release, anywhere in the graph is refused naming both: a commit is not chosen among, since none is higher.avin add <coordinate>@<rev>writes the full id.- What a dependency brings in: its modules, under their own names; not its root directory’s
files (its
main) nor itstestsdirectory, so a program can be depended on andavin testruns only the package’s own tests. One module in two packages is refused. A directory holding its own manifest is another package and never a module of the tree above it. - Version selection: the highest version any manifest in the graph asks for, over every member of a workspace.
- The cache is the machine’s,
<cache>/avin/pkg/<coordinate>/@v<version>/, the clone’s.gitremoved and the tree’s hash written beside it. Builds fetch; the language server does not. avin.sum:<coordinate> v<version> sha256:<hex>per fetched package and version read, one file per project (the workspace root’s); the hash is Sysl’s tree hash (SHA-256 of a sorted listing of each file’s SHA-256 and path,.gitand the root’s.avin/left out). A mismatch is refused; a build only adds lines;avin tidy [--check]rewrites it to what the whole resolution reads.- Workspaces: Sysl’s: members listed by directory with
*within a name, a root with apackageblock a member, a root without one taking no dependencies and refused as a program. - Finding the package: every command walks up from the path it is given to the nearest
manifest with a
packageblock, a workspace root without one being passed over. Sysl looks only beside the path; walking up is what lets a file, a test directory or an editor’s open file name its package. avin new <dir> [--lib]names the package by the directory, writes a module of that name (-written_),main.avinunless--lib, a test intests/and a.gitignoreof.avin/; the namesavinandtestsare refused.avin buildnames the executable after the package.avin add <coordinate>[@<version>] [<package>]records a git dependency: the version is the one given, or the highest release tag the host lists (vand three numbers; no release is an error naming the way to give one). The package is fetched first and listed under the name its own manifest gives it; a dependency already listed, under that coordinate or that name, has its entry replaced in place, to a lower version too. The edit is made in the manifest’s text, so comments and layout stay: the entry goes last in thedependenciesblock, a block being made at the end of the file when there is none. The result is resolved andavin.sumgains its lines (a version that is no longer chosen keeps its line untilavin tidy); where fetching or resolving fails, the manifest is put back as it was. It adds only git dependencies: a path dependency is written by hand.
- The manifest:
-
Settled by the user 2026-11-04: Repeated parameters beside overloads and constructors (declarations): an overload with a repeated parameter is a candidate only where no overload without one accepts the call, so
pick(x: long)takespick(1)besidepick(xs: int*); among those with one, the arguments are compared by the element type. A class’s constructor may end with a repeated parameter, whose field is aVector[T](class Path(val parts: string*)), and a subclass passes it on with: Path(parts*). The core library gainsmax(first, rest*)andmin(first, rest*)onT: Ord, answering the greatest or least of one value or more, the first of equal ones. -
Settled by the user 2026-11-04: Option, Result and string methods (errors, types):
Optiongainsexists,forall,contains(onT: Eq, which every type meets),toList,toVectorandzip;Resultgainsexists,forall,toListandorElse(f), whereftakes the error and answers aResultthat may have another error type.forallis true ofNoneand of anErr.stringgainschars,count,split,lines,isBlank,reverse,padStart,padEnd,equalsIgnoreCase,take,drop,takeRightanddropRight, which count characters where the older methods count bytes.splitkeeps every empty piece and traps on an empty separator (no piece boundary is defined there).linesends a line at\nor\r\n; a terminator at the end starts no further line, the empty string has no lines, and a lone\rstays in its line.take,drop,takeRight,dropRightand the padding widths clamp rather than trap. -
Settled by the user 2026-11-04: The methods every
Iterablehas (collections): folds,reduce(trapping when empty) andreduceOption, searches,count,minBy/maxByandmin/max(trapping when empty) withminByOption/maxByOptionandminOption/maxOption(answeringOption), the reference library’s names,mkString,partition,groupBy,groupMap,groupMapReduce, the conversions andzipWithIndexare written once onIterableand replace the copiesSeqandSethad. A collection they make is aVector, whatever the receiver:partitionanswers(Vector[T], Vector[T]),groupByaMap[K, Vector[T]],zipWithIndexaVector[(T, int)], so a set’s or a map’s partition keeps every element, equal results included, and a list’s comes back indexed. A type’s own method of the same signature still answers where the type is known (List.toListis the list itself).Iteratorhas lazymap,filter,take,drop,takeWhile,dropWhile,zipandzipWithIndexanswering iterators; itszipWithIndexis the trait’s own method and so is found beforeIterable‘s. To compile these, a method table holds a method at a position only for the types a call through that position can reach, by the receiver’s static type, so a trait method that makes an instance at a larger type argument (zipWithIndexon anIterator[(T, int)]) is not compiled for every type it makes. -
Settled by the user 2026-11-04: Set and map methods (collections): an immutable
Sethas++and--taking anyIterable[A]besideunion,intersect,diffandsubsetOf, which keep their names and theirSetparameter;+and-stay reserved forAddandSub, so one element goes in withincland out withexcl, the reference library’s names. An immutableMap‘s++takes anyIterable[(K, V)]and--anyIterable[K].Map.keys()andvalues()answer aVectorin iteration order, so the two line up by index, rather than one-shot iterators;keysIterator()andvaluesIterator()are the lazy forms, andkeySet()answers aSet. A mutable map’skeys()andvalues()are likewise vector snapshots and itskeySet()an immutableSetsnapshot.transformis the new-map form taking the key and the value (mapValuestakes the value alone) on both maps, and a mutable map has no in-placetransform. Everything that builds a collection from a mutable set or map (map,flatMap,union,intersect,diff,mapValues,transform,filterKeys) answers a new mutable one;filterInPlace(p)andupdateWith(k, f)change in place,updateWithanswering the new binding as anOption.+=,-=,++=and--=are methods on the mutable collections (a map’s+=takes a(key, value)pair), so they work on aval; removing an absent element or key is not an error. -
Settled by the user 2026-11-04: Sorting (collections): every
Seqhassorted()(elementsOrd),sortBy[K: Ord](key)andsortWith(compare: (T, T) -> int), answering aVector;Listhas its own three answering aList.Array,BufferandDequesort in place withsortInPlace(),sortInPlaceBy(key)andsortInPlaceWith(compare), the reference library’s names. Every sort is a stable merge sort, O(n log n) comparisons in the worst case with one scratch copy of the elements;sortByandsortInPlaceBycomputekeyonce per element.avin.fs.listDiranswers its names sorted by code point rather than in the file system’s order. -
Settled by the user 2026-11-04: The methods every
Seqhas (collections):map,flatMap,collect,filter,filterNot,withFilter,take,drop,takeWhile,dropWhile,takeRight,dropRight,slice,splitAt,span,tail,init,reverse,++,:+,+:,updated,padTo,indices,zip,zipAll,scanLeft,distinct,distinctBy,grouped,sliding,lastIndexOf,lastIndexWhere,startsWith,endsWith,sameElements,intersectanddiffare written once onSeq, answering aVector(indicesaRange,groupedandslidinganIterator[Vector[T]]).List,VectorandArraySeqkeep or gain their own versions answering their own kind. The mutableArray,BufferandDequeanswer the element-wisemap,flatMap,collect,filterandfilterNotwith a new collection of their own kind and the structural methods with aVector, so a structural method never shares or aliases a mutable receiver;Array.slicestays anArray. A count is clamped to0 .. length();slicetraps unless its indices are in order within the sequence, as it does on strings and arrays.intersectanddiffare multiset operations: each occurrence in the argument matches the first unmatched equal element, and the receiver’s order is kept.Rangeis aSeq[int]with constant-timelength,applyandcontains, and so an(int) -> int. Overload resolution accepts an argument of a subtype of a parameter’s type, as a single function’s call does, and compares candidates by the same conformance, so a type’s own++(other: List[T])andSeq‘s++(other: Iterable[T])are overloads of which the first is more specific. -
Settled by the user 2026-11-04: Two sequences are equal when they have the same elements in order, whichever kinds they are: a
Vector,List,ArraySeq,Array,Buffer,DequeandRangeof equal elements compare equal with==and hash alike, with one comparison and one hash written once onSeqfor them all.==between two sequence types needs the same element type on both sides (aVector[int]and aList[string]are a compile-time error, as any two types with no common type are); a value typed asSeq[T]compares with any sequence. A class that implementsEqitself keeps its own equality between two of its instances. Settled (user, 2026-11-04): throughAnyand trait-typed values sequences of equal elements in order are equal whatever their class, with hashes that agree (val a: Any = [1, 2]; a == List(1, 2)istrue); the elements are compared asAnyvalues are, so[1] == ["a"]held asAnyisfalse. AnArrayis aSeqhere and compares by contents, as it already did. The mutableArray,BufferandDequecompare as they are when the comparison runs, so a hash held across a change is stale, as it was before. -
Settled by the user 2026-11-04: Ranges of other integer types are
NumericRange[T: Integer].Rangestays theintrange, and a bareRangein a signature means it.a..banda..<bwritten as values make aNumericRange[T]where the bounds are integers of any type other thanint(long,i8,i16, …); an integer literal bound takes its type from the other bound, and bounds of two types are an error.bytakes a step of the same type,T. It is aSeq[T]with theRangerules: a zero step traps, a range is empty when its start lies past its limit in the step’s direction, and iteration stops without stepping past the limit, so it never passes either end ofT.get,apply,head,containsandisEmptyare answered from the bounds and never wrap, at any width;length()traps beyondint, andlast()and the other questions that count the values trap for a range whose ends are more than the largestlongapart (the smallestlongto the largest), which only a range oflongs can be.forover a range written in place already counted any integer type, and still does. -
Settled by the user 2026-11-04: Value definitions in a
forwithyield(for comprehensions):pattern = valueafter a generator, each with its ownifguards, written with noval, and never first. It is evaluated once per element that reaches it and binds in what follows. Where no guard follows, it is avalin the function passed to its generator’s source; where a guard follows, it and the definitions before it after the same generator pair each element with its value through the source’smap, so it is evaluated for every element before that guard tests any, and over a set or map the pair has to be hashable. A definition may not rebind a name its generator or an earlier definition after it binds; a later generator may. Settled on the user’s delegation 2026-11-11 as no longer open: built and pinned at-O0and-O2bytests/run/for_yield_definitions.avinandtests/run/spec_collections_comprehensions.avin. -
Settled by the user 2026-11-04: Comprehensions over the mutable collections (for comprehensions): a mutable
SetandMaphavewithFilter, a lazy view as the immutable ones have, and a mutableMapamapover its entries as pairs, so the first source’s kind decides the result as elsewhere: a new mutable set or map, as anArray, aBufferor aDequegives a new one of its own kind, the source unchanged. -
Settled by the user 2026-11-04:
avin.process(system library):args() -> Vector[string]holds the arguments after the program’s name, andprogramName()gives the name separately;env(name)is anOption[string];exit(code: int) -> Nothingflushes standard output first, as a trap does. Arguments are checked as UTF-8 at startup. A test run byavin testsees no arguments.mainmay take the same vector:main(args: Vector[string])(settled above). -
Settled by the user 2026-11-04:
avin.fsandavin.io(system library):IoError, shared by every module that does input or output, lives inavin.ioas a plaindatatype with the variantsNotFound,PermissionDenied,AlreadyExists,IsADirectory,NotADirectory,DirectoryNotEmpty,InvalidUtf8(offset: long)andOther(text: string), and amessage()sentence.avin.fsreads and writes whole files (readText,readBytes,writeText,appendText,writeBytes,appendBytes), asksexists,isDirandisFile, and makes and removes (createDir,createDirAll,createTempDir,remove,removeDir,removeDirAll), each failure anIoErrorin aResult. Writing replaces a file and appending creates one;createDirAllaccepts a directory already there andremoveDirAlla path already gone.listDir(dir) -> Result[Vector[string], IoError]answers the entries’ names, without the directory and without.and.., sorted by code point, so two listings of an unchanged directory agree. -
Settled by the user 2026-11-04: Standard input and error, in
avin.iobesideIoError(system library): standard input as text throughreadLine() -> Option[string],lines() -> Iterator[string]andreadAll() -> string, sharing one runtime-held buffer. A line ends at\nwith a\rbefore it trimmed; the last line needs no terminator. Ill-formed UTF-8 becomes U+FFFD and a failed read ends the input, so reading standard input answers noIoError, wherefs.readTextanswersInvalidUtf8.eprintln(x)mirrorsprintlnon standard error and is in the prelude withStandardError, an unbufferedWriter; every write to standard error flushes standard output first. A test run byavin testreads empty input. -
Settled by the user 2026-11-04: Running and testing (stage 10):
avin run <program> [-O0 | -O2] [-- args]builds into.avin/build/in the program’s directory, reuses the executable while nothing it was built from has changed, and exits with the program’s status, or 128 and the signal’s number for a trap. Its arguments reach the process; reading them isavin.process‘s, in the system library. A test is a top-level@testfunction of the program, in any module, taking nothing and yielding unit, named by the function or by@test("a sentence"); a program built for its tests need not havemain.runis the default command and the current directory the default program:avinisavin run .,avin <path> ...isavin run <path> ...when the first argument is not a command name, and the commands taking a program default it to.. A command name is always the command; a path that spells one is reached as./test.avin test‘s first argument is the program when it names an existing path and the filter otherwise.avin test [<program>] [filter]builds one executable and runs each test in a process of its own, so a trap stops only that test, reportingokorFAILper test grouped by file, the reason and the test’s output under a failure, andN passed, M failed; it exits 1 when any failed. The core library’sassert(condition),assert(condition, message)andassertEq(actual, expected)(withEqandDebugbounds, showing both values’Debugforms) trap at the assertion’s place. -
Settled by the user 2026-11-04: Test attributes, hooks and
@testsfiles (declarations), following Sysl’s model:- A test yields unit or a
Result[unit, E]withE: Display; anErrfails it, readingtest answered Err: <error>at the test’s name. @test‘s arguments: a description first, thenshould_trap(alone, or with text the run’s output must contain),timeout: N(whole seconds, 0 to 2147483, 0 for none, in place of the run’s 60) andignore: "reason"(required and not empty), each at most once.should_trapis satisfied by a trap, not by a non-zero exit. An ignored test starts no process and runs no hook, and the summary adds, K ignoredwhen K is not 0.- Hooks
@setup,@teardown,@setup_all,@teardown_all, at most one of each per module, top-level, taking and yielding nothing.@setupruns in the test’s process;@teardownthere after a test that returned and in a process of its own after one that trapped or timed out (not after a failed@setup); the_allpair each in a process of their own, around the module’s selected tests that are not ignored. A failed@setupfails its test unrun; a failed@setup_allis a failure of its own and fails each of the module’s tests unrun, and skips@teardown_all; a failed@teardownor@teardown_allis a failure of its own. @testsfiles are checked by every command and built only byavin test: their module-level values are not computed in a program that runs. Only a@testfunction, a hook (a lambda in either counting as it) or another@testsfile may name what one declares; an impl in one is for a type or of a trait it declares;mainis not declared in one.
- A test yields unit or a
-
Settled by the user 2026-11-04: Format specifiers (strings and formatting):
- Integers are signed in every base:
%x,%X,%oand%bwrite a negative value as-and its magnitude’s digits (${-42}%xis-2a), so the text does not depend on the value’s width, and+and the space flag apply to them as to%d. There is no%u; it is refused with a pointer to%d. - A flag that changes nothing under its conversion is an error, as is a precision under
%c.%srefuses the numbers (integers,byte,real), which have conversions of their own; it takes every otherDisplayvalue. %scounts characters: its width and precision are characters, not bytes, as everyDisplaywidth is.- Only a
%right after a hole is special: there is no%%escape;%anywhere else, doubled or not, is text. - A count written as a hole is an integer of any width, not a
byte; a negative width pads on the right, a negative precision is none, and a count beyondintis the largestint(FormatSpec.withWidth,withPrecision). StringContext.f, called directly, reads its specifiers as it runs: a malformed one,%?(its arguments areDisplayvalues) and a count that is not anintor alongtrap; a value under a conversion its type does not take renders in its own form.
- Integers are signed in every base:
-
Settled by the user 2026-11-04: The core library’s own tests (tests): they live in
library/tests, as a package’s live in itstestsdirectory, and are an ordinary program of@testfunctions in its root module, whichavin test library/testsruns and the compiler’s gate runs at-O0and-O2. They test the library through its public names, as a program sees it. The directory is no part of the core library every program is compiled with, and a@testin the core library’s own modules, like one in a dependency, is never a program’s test. -
Settled by the user 2026-11-04: A collection added to itself (collections):
b.addAll(b)andb ++= bon aBufferor aDequeappend the elements it held when the call began, once, ands --= son a mutableSetempties it. -
Superseded 2026-11-05 by the dates and times entry that follows; kept as it was. Settled by the user 2026-11-04:
avin.time:Duration,Instant(monotonic) andWallTime(wall clock, aDurationsince the 1970 epoch) are data types counting whole microseconds in along, overflow trapping; the two clocks are distinct types so their readings never mix. A duration implementsAdd,Sub,Neg, and scales by alongwith its methods*and/; a reading combines with a duration through its methods+and-, and two readings of one clock through-(orsince), which yields theirDuration. The text forms are a duration’s largest-unit form (1.5ms) and an ISO 8601 UTC timestamp. Sleeping and calendar fields beyond the timestamp text are not part of it yet. -
Settled by the user 2026-11-05: dates and times (
avin.time) follow slate’s date/time design with Avin’s spellings (types PascalCase, functions lowerCamelCase). Eight types:Instant(a point on the timeline, microseconds since 1970 UTC, displayed as ISO 8601 withZ; it replacesWallTime),Duration,Date(a calendar date with no zone; noLocalprefix anywhere),Time(a time of day),DateTime(a date and a time, no zone),Zone,Zoned(a date-time in a zone, the only zoned type) andPeriod(months and years). There is no monotonicInstant:monotonic()answers aDuration, a monotonic reading naming no point in time, and an elapsed time ismonotonic() - start. Makers:now(),monotonic(),date(y, m, d),time(h, m, s),dateTime(…),zone("America/Toronto"),localZone(), andutc, a value rather than a call;epochSeconds,epochMillisandepochMicrosto and from counts; the durationsmicros millis seconds minutes hours days weeks, also as methods (2.hours); the periodsmonthsandyears. The implementation binds with@syslover Sysl 0.10.0’ssysl.time(Date,Time,DateTime,YearMonthDay,Offset,Weekday,Resolution,Zoneoversysl.time.tzifwithoffset_atandresolve,Zoned,Period), with the system clock and the local zone fromsysl.posix.time, and no new C. The choices the design makes beyond these are under Proposed. -
Settled by the user 2026-11-04: Bindings to Sysl packages (packages, bindings): a manifest names the Sysl packages its bindings reach in a block of its own,
sysl-dependencies, besidedependencies, each entry written as an Avin dependency is (gitwithversionorrev, orpath; neverworkspace). The block is separate because Sysl, not Avin, resolves, fetches and verifies those packages: they are not Avin packages, so they take no part in Avin’s version selection,avin.sum,avin addoravin tidy. The shim package’s manifest lists every Sysl dependency of every package in the program, so a library’s bindings build in any program that uses it; one name at two releases of one coordinate takes the higher, and one name with any other two origins is refused naming both. A fetched package may not name a Sysl directory. The shim archive and the cached executable are keyed by these entries and by the sources of each Sysl package named by directory. Sysl’s other dependency keys (mount,features,options) are not offered yet. -
Settled by the user 2026-11-04: The rest of the system library (system library), each module following the reference standard library’s names and shapes where Avin’s rules allow:
- The environment and the platform
are functions of
avin.process, besideenv, not a module of their own:environment()as aMap,currentDir,homeDir,executable,processors,pidandos(). There is no property store and nothing sets a variable; a child’s variables are set on its command. Bindings:sysl.fs.current_dirandhome_dir,sysl.env.current_exe,sysl.process.pid(au32, which fits along),sysl.osthrough a mirror ofsysl.Os, and the runtime’s processor count.environment()needssysl.env.vars, which answers aBufof pairs: it waits for tuples as a boundary type, a stage-7 addition. - Commands in
avin.process: aCommandvalue, combined with|(a pipeline),andThen,orElseandfollowedBy, redirected withtoFile,appendTo,fromFileandwithInput, and run byrun()(the exit status),output()(the text, any status but success anErr),lines()(an iterator as output arrives) andstart()(aChild). Importing the module addsrun()andoutput()tostring. Operators Avin cannot define: postfix!and!!(no method is called postfix, and!is the language’s), and the spellings with#(#was no operator character when this was built; it is one since branchlazy-cons-operator, and the words stay), so#|is|, and#&&,#||,###,#>,#>>and#<are words;run()is the status, where the reference’srun()starts the process, which here isstart(). Bindings:sysl.process.spawnandpipe, with a mirror ofStdioholding asysl.fs.Filehandle,Spawneda handle waited forblocking,Statusmirrored asExitStatusitself,Var,sysl.fs.create,appendandopenfor the redirections, andsysl.io.FdReaderforlines(), which answers bytes as they arrive. Sourceinavin.io:fromFile(read whole, every failure up front),fromString,stdin(), andlines(),chars()andreadAll(), each consuming. The reference’sgetLinesandmkStringarelinesandreadAll, the namesavin.ioalready uses. No new binding: it is written overfs.readTextand standard input’s buffer, with one runtime entry taking a character from that buffer forchars(). Not blocked.avin.random: aRandomclass (Random(seed)reproducible,Random()seeded by the platform) withnextInt,nextLong, bounded forms,between,nextReal,nextBoolean,nextGaussian,nextBytes,alphanumeric,shuffleandsetSeed; the companion’s methods use one shared, locked generator. PCG32, written in Avin with the wrapping operators, so a seed gives the same sequence everywhere. Binding: one runtime function for the platform’s seed oversysl.posix.rand.seed_from_os, since au64abovelong.MaxValuetraps at a binding’s result; it answers the entropy’s top 63 bits.nextGaussianusesavin.math‘ssqrtandlog.avin.net:TcpStreamandTcpListener;Url, parsed and percent-encoded, written in Avin; an HTTP/1.1 client (get,post,sendwith aRequest) written in Avin over the TCP stream, a status never an error.IoErrorgainsConnectionRefused,ConnectionResetandTimedOut. Bindings:sysl.net.resolve,socketand theSocketmethods, held as an opaque handle (aSocket, and theAddressit connects to, are not boundary types).Urlneeds neither.httpstakes a Sysl TLS package, named in the library’ssysl-dependenciesand bound as any package is; opaque handles and bindings to Sysl packages beyond the standard library are both in the compiler.- Concurrency stays in
avin.threads; there is no separate concurrency module. The reference’s futures map onto what is there (successful,allforsequence,firstforfirstCompletedOf,awaitfor waiting with a time limit); added areFuture.traverse,mapErrandorElseon a future of aResult(itsrecoverandfallbackTo), anExecutorfor pools of one’s own (its execution context, chosen explicitly),threads.blocking(body)andthreads.sleep(d). There is nofailedorfilter, since a future carries no failure. Bindings: none beyond a runtime timed wait forsleep. Not blocked. - JSON is a package of its own, not part of the system library: the package
dev.avinlang.json(settled by the user 2026-11-13; see that entry).
- The environment and the platform
are functions of
-
Settled by the user 2026-11-04: Lower bounds and the expected type (generics): the expected type decides a lower-bounded type argument only where it admits the bound; otherwise the argument is inferred from the bound and the arguments, and the result is passed as any value is. So
println(m.getOrElse(k, "none"), n)on aMap[string, string], where each argument expects aDisplay, takesWasstringrather than reportingDisplayas no supertype ofstring. A delayed (by-name) argument widens an open lower-bounded type argument as any other argument does:cats.getOrElse(k, dog)is anAnimal. Both keep programs working that called the methods before they took[W >: V]. -
Settled by the user 2026-11-04: Trait fields (declarations): a trait’s field declares its type, since each conforming class’s layout and the trait’s
valare known before any body is checked; it is public, as every member of a trait is, and is neverlazy. A class never overrides a trait’s field,valorvar: declaring a field of its name is an error rather than an override. A trait never redeclares, with a value, avalof a trait it requires. -
Settled by the user 2026-11-04: The wrapping conversion is spelled
i8.wrap(x), as the wrapping operators are spelled+%: the integer type’s name,.wrap, one operand, any integer target (a bounded type parameter included,T.wrap(n)). The core library needs it to test whether a value fits a narrower width (the formatter converts a generic integer tolongand back). -
Settled by the user 2026-11-04:
avin.regex: the pattern language and its matching follow the established backtracking dialect exactly: leftmost-first alternation, greedy, reluctant and possessive repetition, atomic groups, bounded lookbehind (a repetition without an upper bound in one is an error), and the same rules for what a repeated group captures;\d,\s,\w,\band the POSIX classes are ASCII unlessUmakes them Unicode’s, andifolds only ASCII withoutu. Matching walks characters (scalar values); every offset in the API is a byte offset, and aPatternError‘s index counts the pattern’s characters. There is no null:group(i),group(name),before(i),after(i)answerOption[string],subgroups()aList[Option[string]], andstart(i)/end(i)-1 for a group that took no part. Members without arguments are methods ("a+".r(),m.start()).Regex(p)traps on an invalid pattern with the error’s message andRegex.compile(p)answers aResult[Regex, PatternError]; a group number or name the match does not have traps. Scripts, blocks, the binary properties beyond the general category (Alphabetic,Uppercase,Lowercase,Ideographic,Word,Alnum, emoji), the flagU,\Xand\b{g}answer from tables generated from the Unicode Character Database, of the version the general categories come from; the flagcand\N{…}are refused with anUnsupportederror. Replacing and splitting follow the same dialect:replaceAllIn(a replacement, or a(Match) -> stringwhose result is read as one),replaceFirstIn,replaceSomeIn,splitanswering anArray[string]with the empty pieces at the end dropped,Pattern.split(s, limit = 0),Regex.quoteandRegex.quoteReplacement;$ntakes digits while they name a group,${name}is the pattern’s own name only, and a reference that cannot be resolved traps with the dialect’s message. -
Settled by the user 2026-11-04: Extractor patterns (control flow):
Name(p…)names a variant wherever one of that name is in scope, and only otherwise a value (an object, a companion, a local) whose type hasunapplyorunapplySeq; where it has both,unapplyis used (the methods are now found through the extractor traits, settled 2026-11-19 below).unapplyanswers abool, matched with no patterns (Even()), or anOption, one pattern matching its value whole and several a tuple’s parts.unapplySeqanswers anOptionof a sequence, matched as a sequence pattern; the prefix-and-sequence form is not taken. The matched value is passed to the method as it is, with no type test first, so the method’s parameter accepts the matched value’s type. An extractor pattern never counts toward exhaustiveness, and since a binding’s or afor‘s pattern must cover every value, extractors appear inmatch,is, clauses and match functions only. -
Settled by the user 2026-11-04: Rest patterns (collections):
rest*or_*, last in a sequence pattern or anunapplySeqextractor’s patterns, binds what the patterns before it leave: on a list the tail, so[]and[head, tail*]cover every list; on another sequence whatdrop(n)answers, aVector, and there too sequence patterns count lengths, so[]and[head, tail*]cover every sequence.[rest*]alone is the whole sequence, of its own type. -
Settled by the user 2026-11-04: A regex as an extractor (regular expressions):
Regex.unapplySeq(s)answers the groups’ texts as aList[string]wheresmatches asmatchesasks, the whole of it or, unanchored, any part. A group that took no part gives the empty string, since astringhas no null.Groups, a top-level object ofavin.regex, takes apart anyMatch‘s groups,Nonefor a pattern with none. There is nounapplySeqtaking aMatchonRegexitself, which would need a match to know the regex that found it. -
Settled by the user 2026-11-04: Sysl handles (Sysl bindings): a
classdeclared with@syslnaming a Sysl type has no parameters, fields or constructor and is made only by a binding that returns it, directly or as the value of anOptionorResult. A method without a body is bound to the Sysl method of its name’s words in snake_case, or to the one its own@sysl("name")names. Every handle hasclose(), which gives its counted reference back and does nothing a second time; a bound method on a closed handle traps at the call with “Nameis closed”; a handle never closed is given back by a finalizer when the collector frees it. A handle compares by identity, and has noDisplay. Settled by the user 2026-11-04, replacing “a collection of handles does not cross” and “a handle crosses back into Sysl only as the receiver of its own methods”: a binding’s result may also be anArrayorVectorof handles, also inside anOptionorResult, made from a Sysl slice orBuf, each element a handle of its own with its own reference and finalizer. A handle by itself goes into Sysl as the receiver of its own methods or as a parameter of any binding or bound method; a closed one passed traps at the call as a bound method on one does. A handle inside anOptionor a collection still does not go into Sysl. Settled by the user 2026-11-04: how a handle is passed to a Sysl parameter. The shim cannot see the Sysl parameter’s type, so it lets Sysl choose: a trait, always held by a counted reference, is passed as the handle’s reference, which the parameter shares; any other type is passed as the parameter’s type asks of a generic helper, by value (a copy), as a pointer to the handle’s own value, or at a&Tas the handle’s own counted reference, which the parameter shares. A*Tparameter of a type with a destructor is refused by Sysl at the binding. Revised on the user’s delegation 2026-11-05 (branchsysl-091): from Sysl 0.9.1 the helper settles at the&T, so a type with a destructor needs no arm of its own and the shim tells only a trait apart; under 0.9.0 a&Tparameter of a type without a destructor received a reference to a copy. Since Sysl now checks the helper’s body against the parameter’s type, each handle parameter of a binding and each handle field of a mirror has helpers of its own, written among that binding’s or mirror’s lines of the shim, so a handle Sysl does not take there is reported as the binding or the mirror not matching, in the handle’s and the place’s Sysl types, and no diagnostic names the shim’s functions (the reject corpus checks that none does). Alternatives weighed: one helper per handle type, reported at the handle class (which names neither the binding nor the parameter at fault); explicit type arguments at each call (the shim cannot see the Sysl parameter’s type). Settled by the user 2026-11-04: a handle is never used by two threads at once, since its counted reference’s count is not atomic. Each handle records an owner, and every use (a bound method, the handle passed as a parameter,close()) compares it with the running code’s and traps with “Namebelongs to another thread” where they differ. The owner is an execution context the runtime can hand over, not an operating system thread: a thread’s body, a pool task whichever worker runs it, and later an actor, re-pointed to whichever thread runs it, so an actor’s handles never trap between its messages; the check is one compare with a word of the running thread’s context, which the runtime sets. Ownership moves: what a thread’s or a future’s body reaches that the caller owns becomes the body’s at its start, and the caller’s later use traps; when the body returns, what it was given and what it returns are in transit, as are a future’s value and what a callback registered on one reaches, and the first code to use a handle in transit takes it. The finalizer never checks: it runs only on an unreachable handle, on the collecting thread while the others are stopped. Settled by the user 2026-11-04, replacing “no mirror holds a handle”: a Sysl mirror’s field may be a handle, by itself (not in anOption, a collection or a tuple), so that Sysl’ssysl.process.Stdioreaches Avin with itsToFile(file: File)andFromFile(file: File). Into Sysl the field is passed exactly as a handle parameter is, its reference shared for a type with a destructor and otherwise a copy or a pointer as the Sysl field asks, with the same traps at the call: “Nameis closed” and “Namebelongs to another thread”. Out of Sysl, which needed nothing more, each such field becomes a handle of its own, as a handle result does. -
Settled by the user 2026-11-04: Tuples cross the Sysl boundary (Sysl bindings). A tuple of boundary types is a Sysl tuple of the same arity, in each direction, each part converted as it would be alone: an integer part out of Sysl takes any Sysl integer with the range check, and tuples nest in one another, in
Option,Result,ArrayandVector, and in a mirror’s fields. A handle may be a part of a tuple that is a binding’s result or the value of itsOptionorResult, soacceptanswersResult[(Socket, Address), IoError]; a tuple holding a handle does not go into Sysl or sit in a collection.avin.processhasenvironment()oversysl.env.vars. -
Settled by the user 2026-11-04: Text blocks under an interpolator that reads no escapes (text blocks). The parts
raw"""…"""and a program’s own interpolators are given have the block’s indentation and trailing blanks dropped but no escape read, and since joining a line with\is an escape, no line joined: the\and the line break after it reach the interpolator as written.sandfjoin lines in the lexer. A backslash directly before a quote or a backslash is taken with it under every prefix, so\"""does not end araw"""block and\\"""does, asraw"…"does not end at\"and does at\\". -
Settled by the user 2026-11-04: A block’s first
"""closes it (text blocks), so""""is the end of the block and a stray quote; a block ending in a quote writes it\". -
Settled by the user 2026-11-04:
avin.random‘s details (system library), where the chapter left them open, so that a seed’s numbers are fixed:- Every generator uses PCG32’s stream 54 (increment 109), the reference implementation’s
demonstration stream, so
Random(42).nextInt()gives its published first output,0xa15c02b7(as anint,-1587805513). Seeding is the reference’s: one step from zero, the seed added, one step more. nextLongis two draws, the first the high half;nextBooleanis a draw’s top bit;nextRealis a 64-bit draw’s top 53 bits over 2^53;nextInt(n)rejects 32-bit draws below2^32 % n, andnextLong(n)andbetweenonlongreject 64-bit draws below2^64 % n;betweenonintisnextIntof the span where it fits anint, andnextLongof it otherwise.betweenonrealdrawsmin + nextReal() * (max - min)again while it rounds up tomax, and traps on a NaN bound and wheremax - minis infinite, besidesmin >= max.nextGaussianis the polar method, keeping the second value of each pair for the next call;setSeeddrops it.nextBytestakes four bytes from each draw, lowest first; a negative count traps.alphanumericdrawsnextInt(62)per character, digits, then upper, then lower case.
- Every generator uses PCG32’s stream 54 (increment 109), the reference implementation’s
demonstration stream, so
-
Settled by the user 2026-11-04:
avin.regex:\b{g}decides a boundary by the grapheme cluster rules over the whole text before it, so it is never inside a cluster: not between the two regional indicators of a flag, nor inside an emoji joined by a zero width joiner or an Indic conjunct.\Xmatches the cluster starting where it stands, one way only, and has no bounded length, so a lookbehind may not hold it. A script is named by any of its names inPropertyValueAliases.txt, ignoring case, and only the scriptsScripts.txtlists, withUnknown, exist; a block by its name inBlocks.txt, that name without spaces, or any of its names inPropertyValueAliases.txt, short ones included, ignoring case. -
Settled by the user 2026-11-04: blocking bindings: a binding whose Sysl call may wait is written
@sysl("module.name", blocking), and a handle’s method bound by its own name@sysl(blocking);blockingis a bare word, written once, and nothing else follows the name. The shim converts every argument and takes a handle method’s own share of the Sysl value, then marks the thread safe for the collector, makes the call, marks it running again (waiting out a collection in progress) and only then converts the result; bytes a handle’s method answers are copied into Sysl memory before the thread leaves the safe region. A blocking call therefore never reads or writes the Avin heap, and an argument that is a pointer into it, such as a buffer Sysl fills, would need its object held by a frame for the whole call. -
Settled by the user 2026-11-04:
Urlfollows RFC 3986 as the established library’s URI does, beyond the first design: user information; IPv6 hosts in brackets, with a zone;base.resolve(ref)by section 5.2, dot-segment removal included;withScheme,withUserInfo,withHost,withPort,withPath,withQueryandwithFragment; and a trappingUrl(text)besideUrl.parse(text), asRegex(p)besideRegex.compile(p).
Actors and state machines (actors and state machines), settled by the user 2026-11-04 as written. They answer the open questions on how actors and machines work and whether their words are reserved.
-
Settled by the user 2026-11-04: Messages are checked by
Sendable, a trait the compiler decides for each type from its structure and that is written as a bound;ActorRef[-M: Sendable]makes the check once, where a message type is named, never at a send. An actor’s parameters and every typeaskandadaptercarry are sendable too. -
Settled by the user 2026-11-04: What is sendable: the scalars,
unitandstring; tuples anddataof sendable fields; the immutable collections of sendable elements; a final class or anobjectwith novarfield and only sendable fields; a trait declared: Sendable, each implementor checked;ActorRef,Behaviour, andFuture,Promise,ChannelandAtomicof a sendable type;Mutexof any type (the one deliberate door to shared mutable state);Once; Sysl handles;Isolated[T]. Not: arrays, buffers, deques, mutable maps and sets, classes with avaror anopenorabstractclass, machines, function values (their captures are not in their type) andAny. -
Settled by the user 2026-11-04: Ownership transfer. A Sysl handle in a message is put in transit by the send and taken by its first user, the receiver; the sender’s later use traps, through the handle’s owner check. A mutable object graph moves as an
Isolated[T], made byisolate(body): the compiler checks the body reads only sendable values from around it and that nothing it calls, transitively, reaches module-level mutable state;take()gets it out once (a second take traps) andwith(f)works on it in place under the same check. -
Settled by the user 2026-11-04: Declaring an actor:
actor Name[T](params) receives M; the body runs once at the actor’s start and holds its fields;receiveholdsmatcharms overM, checked for exhaustiveness; methods are private helpers;selfis the actor’sActorRef[M], and the object holding its state is never a value. -
Settled by the user 2026-11-04: Behaviours and
spawn:Counter(0)is an immutableBehaviour[M], andspawn(behaviour, onFailure = Escalate, executor = Executor.shared())starts it and answers anActorRef[M], inavin.actors. Code an actor runs starts a child; code elsewhere a top-level actor. -
Settled by the user 2026-11-04:
telland the mailbox:tell(message)never waits and never fails (no!, which is reserved); the mailbox is unbounded; one sender’s messages to one actor arrive in order; a message to an ended actor is dropped. (Revised 2026-11-19, branchbounded-mailbox: unbounded unless the actor is spawned with aBoundedmailbox, a full one’stelldropping by its overflow policy, andAskErrorgainingFull; the entry under Actor patterns.) -
Settled by the user 2026-11-04:
askisask(make: ActorRef[R] -> M, timeout: Duration) -> Future[Result[R, AskError]], the timeout required,AskErrorbeingTimedOutorEnded; reply addresses are ordinaryActorRef[R]s;adapter(f)makes a reference translating another protocol into the actor’s own;pipeToSelf(future, f)delivers a future’s value as a message. -
Settled by the user 2026-11-04: Supervision: a trap in an actor fails only that actor, its frames unwound and the trap reported with the actor’s name, except while it holds a
Mutex, runs aOnce, initializes alazy valor is inside a Sysl call, where the program stops.SupervisionisEscalate(the default: the parent fails, and a top-level actor stops the program, so an unsupervised program behaves as one with threads),Stop, orRestart(limit, within), re-running the body from the same behaviour with the mailbox kept. There is no resuming with the old state. -
Settled by the user 2026-11-04: Lifecycle:
stop()ends the actor after the current message, dropping its mailbox;stop(child)only for its own children; children end first; astoppingblock runs at every end and restart;watch(ref, message)andwatch(ref, f: Ending -> M)deliver the end into the watcher’s own mailbox,EndingbeingStoppedorFailed(reason);ref.ended()is aFuture[Ending]for code outside actors; an actor is not collected while it runs; the program ends whenmainreturns. -
Settled by the user 2026-11-04: Timers:
after(delay, message)andevery(interval, message)answer a cancellableTimer, queued like any message and cancelled when the actor ends or restarts. -
Settled by the user 2026-11-04: Scheduling: actors are tasks on an
Executor(the shared pool by default); an actor runs on one thread at a time, each message’s handling happening before the next’s; a worker handles at most 16 messages of one actor before re-queuing it; the worker repoints its context’s owner word to the actor so the actor’s handles never trap; a waiting actor is replaced in the pool as a waiting future is;tellhappens before the handling of its message. -
Settled by the user 2026-11-04: Machines:
machine Name receives Ewithstate S(params)blocks; an arm’s value is the next state, orstay; the first state, without parameters, is the start;enterandleaverun on every transition (a state yielded again included) and not onstay;receiveholds arms shared by every state, tried after the state’s own; the compiler checks every state handles every event;handle(event)answers the new state andstate()the current one, of the generatedName.Statedata type; a machine is not sendable, and handling an event from inside its own handler traps. -
Settled by the user 2026-11-04: An actor’s behaviour is a machine: an actor’s body takes the same
stateblocks, its messages being the events, with the same checks; a restart starts it again in its first state. -
Settled by the user 2026-11-04: Keywords are contextual:
actorandmachineonly where a declaration starts,receivesonly in their headers, andstate,receive,enter,leave,stoppingandstayonly inside their bodies at the start of a line (stayas an arm’s value), sostatestays an ordinary name elsewhere. -
Settled on the user’s delegation 2026-11-05: Handing a handle over explicitly (Sysl bindings). The spec has no spelling for it. Proposed:
handOff(value: Any)inavin.threads, putting every handlevaluereaches that the running code owns in transit, for the next code to use it; andChannel.senddoing the same with what it sends, which it does not do now because handing a value over walks it, and a channel of plain values should not pay for that (the compiler would skip the walk for a type that cannot reach a handle). Review with the user:Channel.sendwalking each message to move handle ownership costs every channel; the compiler skipping the walk for types that cannot reach a handle is the mitigation. -
Settled on the user’s delegation 2026-11-05: Executors (2026-11-04):
Executor.fixed(n)keeps at mostntasks working at once and starts its workers as work comes, as the shared pool does, a worker waiting inawaitorblockingleaving its place to another;nbelow one traps. Aftershutdown(),ex.future(body)traps, while themap,flatMapandonCompleteof futures already made on the executor still run there, on a worker started for them where none is left, so no future made before is stranded.Executor.shared().shutdown()traps, since everyFuture(body)runs there.ex.isShutdown()answers whether it was shut down.Future.successful,Future.all,Future.first,Future.traverseand a promise’s future belong to the shared executor. -
Settled on the user’s delegation 2026-11-05:
sleep(2026-11-04): a worker that sleeps keeps its place in its pool; a body that should leave it while it sleeps writesblocking(sleep(d)). Sleeping is a runtime function boundblockingover Sysl’ssleep, which waits out the whole duration. -
Settled on the user’s delegation 2026-11-05:
orElseon a future of aResult(2026-11-04):orElse[U >: T, F](other: -> Future[Result[U, F]]), widening the value asResult.orElsedoes.Futurestays invariant, since its cell is a mutable field, so a fallback written in place asFuture.successful(Ok(0))needs its type stated where nothing else decides its error type.Futurestays invariant: exempting object-private fields from the variance check (as the user had accepted) proved unsound here, because each set of type arguments has its own code and a method run through a wider view could store a value of the wider type in a field the narrower view reads (probe on branch private-variance, not landed). Sound alternatives, not taken now: dispatching a class with object-private members by the type arguments in its header, or reading type arguments from the object at run time. Review with the user: this reverses an accepted recommendation. -
Settled on the user’s delegation 2026-11-05: Weighted choice in
avin.random, approved in kind by the user 2026-11-04, the names and details proposed:choose[T](items: Seq[T]) -> Tis uniform (onenextInt(items.length())) and traps on an empty sequence.chooseWeighted(weights: Seq[real]) -> intanswers an index andchooseWeighted[T](pairs: Seq[(T, real)]) -> Tan item, the two overloaded by parameter type. Both are onRandomand on the companion’s shared generator.- A draw is
nextReal()times the total of the weights, redrawn while it rounds up to the total, and the answer is the first index whose running total is above it, so a zero weight is never chosen and a seed replays. The traps: no weights, a weight that is negative or NaN, an infinite weight, a total that overflows, a total of zero. Weighted[T](pairs)holds the running totals and the items, built once;sample(rng: Random) -> Tdraws by binary search, O(log n), andsize()is the number of items. It draws exactly aschooseWeightedwould from the same generator state. The alias method (O(1) a draw, a different mapping of draws to items) was not taken: the cumulative table keeps one draw per sample and a mapping a reader can follow.
-
Settled on the user’s delegation 2026-11-05:
Url‘s details (system library), where the design left them open:Urlis adatatype whosehostis anOption[string],Nonewhere there is no authority (mailto:a@b) andSome("")where it is empty (file:///etc); an IPv6 host keeps its brackets;userInfo,queryandfragmentareOptions likeport.- Components are kept as written, escapes and all;
Url.decodeis the way to their text. parseholds the scheme and host in lower case and a default port asNone, so==compares the normalized URL and display needs no work of its own. Defaults are 80 forhttpandws, 443 forhttpsandwss, andportOrDefault()answers anOption[int],Nonefor a scheme with no default.- Escapes that do not decode to UTF-8 make text no URL (
InvalidUtf8), atparseand in eachwithmethod, soqueryParamskeeps the plainVectorthe design gives it;Url.decodeanswers aResult. queryParamsreads+as a space and skips empty pieces;decodekeeps+.UrlErrorisMissingScheme,BadScheme,BadCharacter,BadPercent,BadHost,BadPortandInvalidUtf8, each but the first with the byte offsetat.- A zone is accepted only as RFC 6874 writes it, after
%25; hosts of a later form ([v7.x]) are accepted; characters beyond ASCII other than controls and spaces are accepted in any component and kept. resolve(ref: string)answers aResult, the reference being text;resolve(ref: Url)takes one already read. Thewithmethods take components as written and trap on one the URL cannot hold; each optional component’s method takes a value or anOption.
-
Settled on the user’s delegation 2026-11-05:
Sourceis a trait, its three readers abstract, so a program can write a source of its own (text made as it is read, a socket later) and hand it to any function that takes one; the kindsavin.iomakes are private classes reached only throughSource.fromFile,fromStringandstdin. The alternative is a final class whose kinds are fixed by the library. -
Settled on the user’s delegation 2026-11-05: An override adds no bound to a type parameter of its own (declarations). Each bound an override, or a method implementing a trait’s, writes on its own type parameters is implied by the overridden method’s bounds on that parameter: one of them, a trait or class one of them conforms to, or
EqorHash, which every type meets; it may keep, weaken or drop bounds. Why: a call through the base type passes any type argument the base’s bounds admit, so an added bound let a program that type-checked run the override at a type without the bound’s methods, which trapped or crashed. The alternatives were requiring the bounds to be exactly the same, which forbids a weakening that is harmless; and checking the bound at each call through the base, which a call cannot do, since it does not know which override it reaches. -
Settled on the user’s delegation 2026-11-05: the methods an
impladds to anopenorabstractclass are variance positions, whatever its fields; the exemption stays for final classes whose fields are all immutable,datatypes and traits. Why: such a method is in the class’s method table, so a call through a wider view runs the copy for the object’s own type arguments, and(b: Box[Animal]).with(cat)on aBox[Dog]answered aBox[Dog]holding a cat, whose dog’s fields read past the object; the core library’sVectorhad the hole. SoVectortakes an element through a lower bound, as maps do::+[W >: T](element: W) -> Vector[W],+:,++,updated, andtoArray[W >: T](), andSeq‘s added:+,+:,++andupdatedwiden alike, so a vector’s own hides them. A vector’siterator()andreverseIterator()areIterator[T]s, and its guard view is the one every sequence has. The alternative, not taken: making an exempt impl method non-virtual, compiled for the receiver’s static type as a trait’s added methods are, which keeps:+(element: T)but would make an added method on an open class behave unlike a method written in its body. -
Settled on the user’s delegation 2026-11-05 (built on branch
avin-net):avin.net‘s TCP and HTTP details (system library), where the chapter left them open:write,writeText,setTimeoutandshutdownOutputanswerResult[unit, IoError], since each can fail;readAll()is added besidereadandreadLine, andTcpListenerhasclose().- A read, write or
acceptafterclose()answersOther("the connection is closed")(or “the listener is closed”) rather than trapping, as a closed handle’s method does. - A host that resolves to no address is
Other(s"no address found for $host"), notNotFound, whose message speaks of files. A port outside 0 to 65535, andread(max)withmaxbelow one, trap at the call, as aUrl‘swithPortdoes with a port it cannot hold. ConnectionResetalso covers a write to a connection the other end has closed (EPIPE).setTimeoutsets the read and the write limit together, in whole milliseconds rounded up; zero or less takes the limit away.bindtakes the host’s first address and lets a port a recently stopped listener used be taken again; the backlog is the platform’s usual 128.- The socket is a handle on
sysl.net‘s ownSocket, which closes its descriptor when its last copy goes (from Sysl 0.9.1; a runtime type wrapping it with a destructor did this before, and was removed on branchsysl-091); so closing the handle, or the collector freeing a forgotten one, closes the socket. The runtime turnssysl.net‘s errors into the four a connection tells apart (avin.rt.net_failure), the error crossing as a handle so that its variants do not join the module’s. - The HTTP client: a
Responsealso has itsreason;text()reads ill-formed UTF-8 as U+FFFD;Requestis a class withmethod,url,headers,bodyandtimeout, the last three defaulted; a method or header name that is not a token, and a header value with a line break, trap;Host,Content-LengthandConnection: closeare written unless the request gives them; an interim1xxis skipped; redirects are 301, 302, 303, 307 and 308, the sixth answered as it is.
-
Settled on the user’s delegation 2026-11-05 (built on branch
sendable):Sendable‘s promises, where the design left them open:- A declaration promises
Sendableas it conforms to any trait: after:in a class’s or a trait’s header, or in an impl for a data type. The promise is checked against the structure, outside the standard library, and anopenorabstractclass that promises it is sendable, each subclass being checked. (Replaced by the Proposed@trusted_sendableentry, branchfix-core-promises: the library’s promises are checked too, but for the classes it marks.) The standard library’s promises are taken as made, since they are for types whose structure cannot show it:Future,Promise,ChannelandAtomicof a sendable type (impls bounded bySendable),Mutexof any type andOnce(in their headers), andVectorof sendable elements.ArraySeq,List,Range, the hash and tree maps and sets,Option,ResultandEitherare sendable by their structure. - A generic trait that promises
Sendableis sendable at sendable type arguments; a type implementing it has the parameters it passes to the trait, other than contravariantly, taken as sendable where it is checked, and is sendable at sendable arguments for them. The immutableMapandSettraits promise it, soHashMap[K, V]is sendable whereKandVare, and a type implementing either is held to it. Sendableis only a bound and a promise; it is not the type of a value.- A
lazy valfield is sendable where its type is, since it is initialized by exactly one thread. (That rests on the runtime initializing alazy valonce under contention, which the testslazy_threads,lazy_threads_manyandsendable_lazypin: threads and futures reading one first together, counting a single run of each initializer.)
- A declaration promises
-
Settled on the user’s delegation 2026-11-05 (built on branch
mirror-handle-fields): a mirror holding a handle goes into Sysl wherever any mirror does (Sysl bindings) — a parameter by itself, or inside anOption, aResult, a collection, a tuple or another mirror — since the shim’s conversion of the mirror checks and passes each handle field wherever it is called, though a bare handle in anOptionor a collection still does not go into Sysl. The alternative is a mirror holding a handle only by itself, as a handle is. -
Settled on the user’s delegation 2026-11-05 (built on branch
tailrec): tail calls, the choices the request left open:- Every self-call in tail position is a loop, with or without
@tailrec, at-O0as at-O2, so a program’s stack use does not depend on its optimization level; the annotation only adds the proof. Alternative: loop only where@tailrecasks, leaving the rest to LLVM at-O2— rejected, since the same program would overflow at-O0and not at-O2. - The right operand of
&&and||is in tail position, as in the reference language:n == 0 || (ok(n) && f(n - 1))is a loop. Alternative: onlyif/matchbranches — simpler to explain, but it refuses a common shape of predicate. - A call on another receiver of the method’s own type is a loop, the receiver becoming
selffor the next pass, as the reference language does for a method that cannot be overridden; a call on a receiver of the class at other type arguments is another instance and@tailrecrefuses it. Alternative: only calls onself— it would refuse list-walking methods such asnext.length(acc + 1). - A private method of an open or abstract class may be
@tailrec, since nothing overrides it; a public one may not. There is nofinalmodifier for a single method, so making a public method of an open class a loop means making it private or the class final. @tailrecis accepted on top-level functions, methods and local functions, and is the one annotation a local function takes; a lambda cannot be annotated. It refuses a function with no recursive call, as the reference language does, rather than accepting it silently.- A function calling itself is made a loop; mutual recursion is left to general tail calls, which need every caller and callee to agree on a calling convention and to unlink the shadow-stack frame before the call, and have their own entry (below).
- The language has no
try,deferorfinally, so there is no pending cleanup to take a call out of tail position; when such a construct is added, a call inside it is not in tail position.
- Every self-call in tail position is a loop, with or without
-
Settled on the user’s delegation 2026-11-05:
Iterable‘s transformations (collections), following the reference collection library (branchcoll-followups).map,flatMap,filter,withFilter,collectandzipare added to everyIterablebyimpl[T] Iterable[T], each returning anIterable(aVectorunderneath) of the results in iteration order, so a program’s own class conforming toIterablehas them; the library’s collections keep their own of the same name and parameter types, of their own kind. To letSeq‘s,Set‘s and the other traits’ versions stand, an impl adding to a trait is passed over where an impl adding the same name and parameter types to a trait that requires it applies (declarations); impls on unrelated traits still clash. Why: the item asked for the members the chapter already claimed, and the impl is how every otherIterableoperation is written. Alternatives: methods with bodies declared in the trait, dispatched through the object’s table, so generic code would get the concrete collection back at run time; that would make every collection’smapanoverride, rule out the bounded versions (TreeSet.map[B: Ord]cannot override an unboundedmap[B]), and dispatch every call. The chapter’s earlier claim that generic code gets the concrete collection back is withdrawn. The review this entry carried, aMapreceiver offering only its pair-makingmap, is superseded by the Proposed entry on a map’smapto other results (branchmap-flatmap). -
Settled on the user’s delegation 2026-11-12 (built on branch
map-flatmap): a map’smapandflatMapto anything other than pairs answer a collection (collections), on the user’s direction that Avin adopt the conveniences of a rich collections library that add no complexity.m.map((k, v) -> Summary(k, v)),m.map(e -> e.0), amatchfunction or a method value making non-pairs, and a comprehension over a map yielding non-pairs, guarded or not, answerIterable[B](aVectorunderneath) in the map’s iteration order; a pair still makes a map of the receiver’s kind (HashMapthroughMap,TreeMap, the mutable ones). Every map has amap[B](f: (K, V) -> B) -> Iterable[B]overload beside its pair-making one, and the filtered views a comprehension’s guard makes havemap[B]andflatMap[B]of one pair; a function of the entry as one pair reachesIterable‘s own. To choose by the lambda’s body, overload resolution gains one rule (declarations): where the candidates left all give a lambda (or amatchfunction) the same parameter types, known without the candidates’ own type arguments, and differ only in the result, the lambda is checked once with those parameters and an open result, and then fits as any typed argument does; of two that fit, the pair-making one is the more specific. WHY: one check of the body, with no speculative re-checking or rollback, settles the common shape exactly, and the rule is invisible where the overloads already agree. ALTERNATIVES: checking the lambda’s body against each candidate in turn and discarding the failures (general, but every check would have to be undone, captures and nested lambdas included); answering aVectorrather than anIterable(handier to index, butIterable‘s ownmap, which a one-pair function reaches, answersIterable, and the two shapes of function should agree); a diagnostic suggesting.toVectorfirst (the audit’s stopgap). Not done: a sorted collection’smapto an element or key that is notOrdis still refused naming the bound, rather than falling back to an unsorted result, since the sorted overload hidesIterable‘s of the same parameter types and the candidates are not held to their bounds while choosing. Review with the user: whether that fallback is wanted too, andIterableversusVectoras the result. -
Settled on the user’s delegation 2026-11-12 (built on branch
map-flatmap):flatMaptakes an option-making function on every collection, by an overloadflatMap[U](f: (T) -> Option[U])beside each collection’s ownflatMapof a collection-making function, answering the same kind:Iterable(aVector), everySeq,Vector,List,ArraySeq,Array,Buffer,Deque,Queue,LazyList(lazily),Iterator(lazily),Set,TreeSet, the mutable sets and bit set, and every filtered view a comprehension’s guard makes. A map’s takes((K, V)) -> Option[(L, W)]into a map of its kind, and any other option into a collection (throughIterable‘s, or the filtered view’s own).Iterable[Option[T]]hasflatteninto aVector,Iterator[Option[T]]into a lazy iterator.OptiongainsflatMap[U](f: (T) -> Iterable[U]) -> Vector[U], so a comprehension drawing from an option and then a collection yields a vector; one drawing from a collection and then options yields the collection’s kind. The lambda’s body chooses between the twoflatMaps by the rule of the entry above. WHY: the overload is a library addition that every call path sees, generic code throughIterableincluded, and leaves options’ representation alone. ALTERNATIVES: makingOptionanIterableof at most one element (impl[T] Iterable[T] for Option[T]), which was built and works,++,concatandIterableparameters taking options included, but the library’sIterator[Iterable[T]]impl then views a type parameter through a traitOptionconforms to, so the representation plan keeps every option of every program as an object rather than a bare pointer (an allocation perSome, andNoneread throughAnychanges); a conversion at the call (a mechanism Avin does not have). Not done:xs ++ maybe,concatand an option given for anIterableparameter, which need the conformance;toListcovers them. Review with the user: whether options as iterables are worth reworking the representation plan for, and theVectorfrom an option’sflatMapof a collection. -
Settled on the user’s delegation 2026-11-05:
rest*binds whatdrop(n)answers (collections), branchcoll-followups. One rule for everyn,n = 0included:[rest*]bindsdrop(0), the list itself on a list and aVectoron a range, an array, a buffer or a deque, where it used to bind the scrutinee itself at its own type. Why: one rule the reader can predict, and a binding that never aliases a mutable array or buffer through a pattern that elsewhere copies. Alternative:[rest*]as the scrutinee, as before, which made the binding’s type depend on whether any element came beforerest*. -
Settled on the user’s delegation 2026-11-05: An empty collection literal joins to its siblings’ type (collections), branch
coll-followups. Among the elements of a literal, the keys or values of a map literal, the branches of anifand the arms of amatch, an empty literal ([],{}, or a literal holding one anywhere) is checked after the others and against the type they agree on, where nothing useful is expected (nothing, orAny), and where that type is a collection its literal shape can build. So[{1: [2]}, {}]andif c then {1: [2]} else {}are maps. Why:{}alone defaults to a set, and an invariantSetnever joins aMap, so the sibling has to settle it before it defaults; the reference language gets the same result from inference. Alternatives: a join rule turningSet[_]into the other side’s map after the fact (the literal’s builder is already chosen by then), or asking for an annotation, as before. -
Settled on the user’s delegation 2026-11-05: A range displays as written (collections), branch
coll-followups:1..5,0..<10,0..<10 by 2, the bounds as given, the step only where it is not 1;Debugthe same, and aNumericRangethe same. Why: it reads back as the expression that made it and costs nothing to render. Alternative: the elements,[1, 2, 3, 4, 5], as a vector shows, which hides that a range is a progression and is unbounded in size. -
Settled on the user’s delegation 2026-11-05: Precision under
%sand%?is the formatter’s (strings and formatting), branchcoll-followups: the value is rendered with no width and no precision throughwriteDisplayedorwriteDebugged, and its first N code points fill the field, for every type; renderers see a precision only under the other conversions. Why: the chapter promised it for every value and only strings honoured it; cut once, no renderer can get it wrong. Alternative: every renderer reading the precision, which each collection and data type would have to implement. -
Settled on the user’s delegation 2026-11-05 (built on branch
regex-hardening):avin.regex‘s limits on matching, backtracking with leftmost-first results kept:- The matcher keeps its own backtrack stack, an array of frames, so a repeated group over a long input takes no deeper a call stack however many repetitions it makes; only a part matched on its own (a repetition’s item matched one way, an atomic group, a lookaround’s body) takes a call, so the call depth follows the pattern’s nesting, never the input. Alternative: a linear-time engine — rejected by the request, as back references, lookarounds and leftmost-first captures need backtracking.
- Each attempt at a start has a step budget, and spending it traps, the message naming the
pattern and the input’s length and saying to make a repetition possessive or atomic. A step is
an operation run or a backtrack frame popped; the budget is 1000 for each character of the
input (plus one) times each operation of the program, never fewer than 10,000,000, about a
tenth of a second of steps and far beyond what a pattern that backtracks only as far as its
input asks takes. The budget is per attempt, not per search, so a search is never stopped for
the number of starts it tries. Alternatives: answering a
Resultfrom every search — rejected, as it would make everyfindFirstInandmatchesa fallible call for what is a defect of the pattern, which the trap’s message says how to fix; no limit (the earlier behaviour) — rejected, as one bad pattern hangs its program. withStepLimit(n)sets an attempt’s budget (nabove 0, or it traps), for a program that wants a tighter bound on untrusted text or a looser one for a pattern known to be slow; the trap’s message then gives the limit. Alternative: a global setting — rejected, as the budget belongs to the pattern.- Review with the user: whether a search should also have a non-trapping form for untrusted
patterns (a
Result-answeringtryFindFirstIn, say), and whether the default budget’s constants are the right ones. A greedy, unbounded repetition of a group in a pattern without a back reference already remembers where a further repetition failed, so the textbook(a+)+$,(a|a)*band(a|aa)+$finish in polynomial time and do not trap; their reluctant, bounded and back-referencing forms are the ones that do.
-
Settled on the user’s delegation 2026-11-05: Guaranteed tail calls (branch
tailcalls). Every call in tail position of a function of the program, by name, through a method table or of a function value, replaces the caller’s stack frame, at-O0as at-O2, so mutual recursion, state machines of functions and continuation passing run in constant stack. A self-call is still a jump within the function, which is cheaper.@tailrecstays about self-recursion.- Every compiled function has LLVM’s
tailccconvention, and a tail call ismusttail call tailccfollowed at once by itsret. The C convention is kept only where code outside the program calls in:main, a C-convention wrapper for each function whose address a Sysl binding’s shim is given, and the closure runner the runtime calls to start a thread. - Calls through method tables and of function values are tail calls too, since every address a table, a type record or a closure holds is a function of the program with its convention. A call the whole-program pass guards by the receiver’s descriptor returns from each of its branches.
- The caller gives its shadow-stack frame back just before the call, as a return does. The arguments are then roots of no frame until the callee links its own, its first act, and nothing between the two allocates, polls or stores, so no collection can see the gap.
- A call stays an ordinary one where an argument may point into the caller’s own stack (a local function given the address of a local it captures), where the core library calls the program’s code (it restores the caller site after), where the result is converted, and in a class’s constructor, which publishes its object after its body. A lambda or local function value that captures a local of its enclosing function is entered through an entry that keeps the local on its own stack, so that entry’s call adds one frame per call; capturing only parameters and values adds none.
- Only a function whose arguments all travel in registers has
tailcc: the context and at most five integers, bools or references, at most eight reals, and no integer wider thanlongas a parameter or the result. The rest keep the C convention and make and receive ordinary calls. Undertailccthe callee pops the arguments passed on the stack, and LLVM’s unoptimized code generation reloads spilled values from the wrong place after such a call (seen as crashes and wrong results at-O0); with every argument in a register there is nothing to pop. The limits are those of the smallest target (x86-64: six integer registers, eight vector ones), so a program’s stack use is the same everywhere. Review with the user: a function with six or more such parameters gets no tail call; lifting the limit means passing the extra arguments in a block the caller’s caller owns, or a fixed LLVM. - Alternatives weighed: merging each group of mutually recursive functions into one function that switches on which one is running (no convention change, but only for calls by name, and code size grows with the group); a trampoline in the library (no compiler work, but every tail call pays an allocation and an indirect return, and the program must be written for it).
- Review with the user. Error backtraces lose the frames a tail call replaced; the user may prefer this only at -O2.
- Every compiled function has LLVM’s
-
Settled on the user’s delegation 2026-11-05 (built on branch
process-commands): How the parts of a command share its settings (commands). Proposed: a directory and variables set on a pipeline or a sequence are every part’s, a part’s own directory replacing it and its own variables added after (a name set twice has the last value). A time limit on a command made of parts bounds the whole, from when it starts: each program is given what is left, a part not yet started when it runs out isTimedOutwithout being started, and of two nested limits the earlier ends it. Output redirected on a pipeline is its last stage’s and input its first’s; on a sequence the file is opened once and shared, so the parts write one after the other and the second reads on where the first stopped. A part’s own redirection replaces the enclosing one, whose file is still opened (and so emptied bytoFile), as a shell’s is. Why: each reads as a shell’s( … )with the setting outside it, which is what a reader expects. Alternatives: a limit given to each program afresh (a sequence of slow parts would never end), and a file opened per part (each part of a sequence would empty what the one before wrote). -
Settled on the user’s delegation 2026-11-05 (built on branch
process-commands): Input given as text, and output captured, go through files (commands). Proposed:withInput(text)writes the text to a temporary file, opened and unlinked before the program starts, andoutput()has the output written to a temporary file read once the command has ended. Why: a pipe the program feeds or drains while it waits is a deadlock once either side outgrows the pipe’s buffer, and a file never fills. The alternative is pipes served by a thread.output()decodes the bytes aslines()does, each ill-formed run replaced with U+FFFD, rather than failing withIo(InvalidUtf8); the alternative is the failure, which would lose the whole output over one byte. Review with the user: the decoding. -
Settled on the user’s delegation 2026-11-06 (branch
command-clear-env): A command’s environment:clearEnv,withoutEnv,withEnvironment(commands). A command keeps its environment changes as an ordered list (set, remove, clear), applied in the order called; on a joined command the command’s list comes before each part’s own.clearEnv()starts from an empty environment,withoutEnv(name)drops one inherited variable (an unset name is no error),withEnvironment(map)isclearEnv()then each entry. With only sets, the running program’s environment is left to Sysl’sinherit_env; once a list clears or removes, the whole environment is built fromenvironment()and handed over withinherit_env = false. A bare program name after a clear is looked for on thePATHthe command was given, or the system’s default path where none, never the running program’s: that is Sysl’sspawnrule, kept so a command never finds a program through a variable it was told not to have. Variables whose name or value is not UTF-8 are not passed once a command removes or clears (environment()passes them over). WHY: a daemon must start jobs from the submitter’s environment, not its own. ALTERNATIVES: a singlewithEnvironmentonly (cannot remove one variable cheaply); a settings pair of a base flag and a removed set (loses the order of calls, soclearEnv().withEnv(x)andwithEnv(x).clearEnvcould not differ); looking the program up on the parent’sPATH(a cleared command would still find programs by a variable it lacks). Review with the user: thePATHlookup rule. -
Settled on the user’s delegation 2026-11-05 (built on branch
process-commands), with one change:kill()and a started sequence (commands). Proposed:Child.kill()sends signal 15 to every program of the command still running and starts no part not yet started;waitFor()then answersSignalled(15)for a program it stopped. A started sequence starts its next part whenwaitFor()orisAlive()finds the part before it has ended, on the code that started it, which owns the processes;lines()over a command holding a sequence moves it on with a thread of its own, since its reader is waiting on the output. A pipeline holding a sequence is polled, its processes asked without waiting at growing intervals up to 16 ms, while a pipeline of programs alone is waited for without polling. Alternatives: signal 9, which a program cannot clean up after, orkill(signal: int = 15); every started command on a thread of its own, whose processes the starting code could then not stop, since a handle belongs to one thread. Settled: signal 15 as proposed. Changed: a started sequence must move on by itself, since a sequence that stalls until its starter asks is a surprise; a thread of its own will own the processes and drive the sequence, and theChildwill ask it to wait or to kill through a channel, which keeps each handle on one thread. Until that is built the sequence moves on only when asked, as described. Review with the user: the signal. -
Settled on the user’s delegation 2026-11-05 (built on branch
core-followups):==and!=onAnyare decided at run time, as equality says: values of one type compare as that type does, by value or by identity, and values of different types, a reference and a value among them, are unequal. The sentence in Any and Nothing saying anAnyhad no equality was stale and is corrected. Rationale: every value has==and a hash, so any value can be a map key, aMap[Any, V]‘s among them, and the compiler already comparedAnys through each value’s own entries. Alternative weighed: no==onAny, so that every comparison goes through a type pattern first, which breaks “every value can be a key”. -
Settled on the user’s delegation 2026-11-05 (built on branch
core-followups):===is defined only where its answer is: at least one side’s static type is a reference type that cannot hold a value type (a class, anobject, an array, a buffer, a function type, or a type parameter bounded by a class). The other side may be the same type, a sub- or superclass, a trait the class conforms to, anAny, or a type parameter with no class bound; anAnyor such a parameter is compared as anAny, and a boxed value there is never the object, so the answer isfalse. Two sides that may each hold a value type (traits,Anys, type parameters with no class bound) are an error, “===is undefined on Shape and Shape, which may hold values with no identity; compare with==, or give one side a class type”; so is a value type on either side. See identity. Rationale: a boxed or data value may be one object or two at the compiler’s choice, so trait-to-trait identity answered arbitrarily (f(Box(2), Box(2))true andf(3, 3)false forf(a: Shape, b: Shape) = a === b), while a class instance is never a boxed value, so mixed class and trait is well defined. Alternatives weighed: rejecting any trait orAnyoperand, which needlessly breaks the library’selements === self(a buffer, deque or set given itself as anIterable); and keeping trait-to-trait identity, which is unsound. A class with a trait it does not conform to is rejected even when the class is open and a subclass might conform. Review with the user: whether an open class and a trait it does not itself conform to should compare, since a subclass may be both. -
Settled on the user’s delegation 2026-11-05 (built on branch
core-followups): a tuple already made converts to a wider tuple only where each part already is what the wider tuple holds: a part that is an object (a string, adatavalue, a tuple, an instance of a class) is its ownAny, and an instance of a subclass is one of its superclass, so(string, int)is a(Any, int); a part that would need a box (a number, abool, achar) does not convert, so(int, int)is not a(Any, int). A tuple written out where the wider one is expected boxes its part there. See Any and Nothing. Rationale: a conversion that changes no bits is free, while a boxed part changes the tuple’s layout and would mean copying the tuple behind a plain assignment. Alternatives weighed: no conversion of a tuple once made (what the chapter said, and needlessly strict for parts that already are objects); converting every part by copying, which hides an allocation. -
Settled on the user’s delegation 2026-11-05 (built on branch
core-followups): two classes with no common superclass that share several unrelated most specific traits do not join, and the error names the traits: “the branches of thisifyield Duck and Goose, which share Swims and Flies but no single most specific type; write the type you want”, and the same ending formatcharms, clauses, collection and map literals and a loop’sbreaks, as inference says. Rationale: the bare “yield Duck and Goose” did not say why two classes that plainly share traits fail to agree. Alternative weighed: choosing the first trait declared, which makes the type depend on declaration order. -
Settled on the user’s delegation 2026-11-05 (built on branch
core-followups): a tuple type pattern tests the type the tuple was made with, as Any and Nothing says, not the classes of its parts:t: (Animal, int)holding aDogdoes not match_: (Dog, int), and a tuple made as a(Dog, int)does wherever it is held. Each part is tested by a tuple pattern with a type pattern inside it,(d: Dog, n), and type patterns no longer say a tuple is “taken down part by part”. Rationale: a tuple’s run-time type is one type, fixed when it is made, so the test agrees with the static type it was made at. Alternative weighed: testing part by part, which would make a tuple’s run-time type depend on what it holds rather than on how it was made. -
Settled on the user’s delegation 2026-11-05 (built on branch
option-ord):Option[T]is anOrdwhenTis,Nonebefore everySomeandSomes as their values, following the reference library’s ordering of options. It makesderives Ordwork on a data type with anOptionfield and lets options sort and havemax/min. Alternative: no order on options, leaving a field of one underivable — rejected as the cost falls on every record with an optional field. (Tuples already hadOrd;EitherandResultfollow in the next entry.) -
Settled on the user’s delegation 2026-11-05 (built on branch
sysl-handles): a handle may name a Sysl trait, and its trait object is kept in a cell (Sysl bindings). Every handle’s object stays two words, the first naming the Sysl value and the second its owner; where the reference is a trait object, two words itself, the first word points at a cell the shim allocates holding it, freed when the reference is given back. The shim tells the cases apart while Sysl compiles it, by whether a reference to the type is wider than a pointer, and treats a trait as always held by a counted reference. Rationale: a struct handle is unchanged and reached as directly as before, the compiled code’s owner and closed checks read the same two words for every handle, and the compiler need not know which Sysl types are traits, which only Sysl does. Alternatives weighed: a handle object of three words for a trait, which needs the compiler to know the Sysl type’s kind before Sysl checks the shim, and moves the owner word of one kind of handle; every handle boxed, which costs a struct handle an allocation and a load for nothing. -
Settled on the user’s delegation 2026-11-05 (built on branch
sysl-handles): anArrayor aVectorof handles that is a parameter goes into Sysl (Sysl bindings), replacing “a handle inside a collection does not go into Sysl”: as a slice of shares of the handles’ Sysl values, each element checked (closed, another owner) as a handle passed by itself is, then made the elements the Sysl parameter takes; a vector as a[]T, an array as a[]const T, as for every collection, and aBufparameter not reached. Only the collection itself is the parameter: not nested, not in anOption, not aList, not a callback’s answer, not a mirror’s field. Rationale: a user interface library’s containers take[]&View; taking shares first means a call that waits reads no Avin object, and what Sysl keeps it keeps by its own count. A slice orBufof handles out of Sysl already became a vector of handles, so nothing changed there. Alternatives weighed: rooting the Avin collection for the call instead of taking shares, which leaves a pointer element reading a value the collector may free once the call returns and Sysl keeps it; allowingListand nested collections, which nothing yet needs. Review with the user: whether anArrayof handles should reach a writable[]&T, since a handle collection’s elements written by Sysl could never reach the array anyway; today it is refused as for every other array, so such a parameter is bound with aVector. -
Settled on the user’s delegation 2026-11-05 (built on branch
sysl-handles): a handle may name an instance of a generic Sysl type,@sysl("module.Signal[string]"), struct or trait (Sysl bindings), its methods bound at that instance. Each type argument is written as Avin writes it and is a boundary type that is one Sysl type: an integer of 8, 16, 32 or 64 bits,byte(spelledu8for Sysl),real,char,bool,unit,string, or anOption, aResultor a tuple of these; the compiler checks the arguments’ shape, Sysl that the type takes them. The shim imports the generic type and spells the instance wherever it names the handle’s type, since Sysl gives no alias to a trait’s instance. Rationale:sysluihands out&Signal[T], and one class per instance needs no generic classes in bindings. Alternatives weighed: mirrors and handles as type arguments, which have Sysl spellings of their own but would make an annotation’s text name Avin types; fully generic bindings, one class for everyT, which stay specified and unbuilt. A&Signal[T]parameter shares the handle’s own signal (from Sysl 0.9.1), so a Sysl function setting a signal is seen by the handle (tests/programs/run/sysl_generic_handle_sharing,tests/programs/run/ui_signal_widgets). -
Settled on the user’s delegation 2026-11-05 (built on branch
tuple-ord):Either[L, R]andResult[T, E]areOrdwhen both sides are.Leftorders before everyRight, following the reference library’s ordering of eithers;Resultis ordered asEitherwithErrin the place ofLeft, so everyErrbefore everyOk. Rationale: both types put the failure on the same side (LeftandErrare the reason,RightandOkthe value), so the one rule “failure before success” holds for both, andErragrees withLeftundertoRight/toLeftconversions. Alternatives weighed:OkbeforeErr, matching the declaration order ofResult‘s variants (which is whatderives Ordwould give a data type, and what a reader ofdata Resultmight expect) but disagreeing withEither; and no order onResult, leaving a record with a result field underivable. Review with the user: theErr-first choice is the one a reader of the declaration could find surprising. Tuples needed no change: theirOrd, lexicographic by part at every arity, was already written by the compiler for each arity and is now covered by tests. -
Settled on the user’s delegation 2026-11-19 (branch
bool-ord):boolisOrd,falsebeforetrue, reversing the earlier rule thatboolhad no order.compare,min/max/clamp,Reverse, sorting,TreeSet/TreeMapkeys, tuple keys and derived orders all take a bool, and<,<=,>and>=are allowed on two bools as on every built-inOrd(one unsigned machine comparison). Rationale: porting a to-do list mettasks.sortBy(t -> (t.done, t.id))refused, the one-line way to put open items first; without an order a bool field also leaves a record underivable forOrdand a tuple key holding a flag unusable, andfalse < trueis the one order everyone already reads (0 before 1). Alternatives weighed: keeping the refusal, so a key is writtenif t.done then 1 else 0(noise at every sort, and still noderives Ordwith a flag); anOrdforboolwithout the operators, a split no otherOrdtype has; a helper such asbyDone, too narrow for a general type.unitkeeps no order. Review with the user: it reverses a settled rule, andb1 < b2reads oddly to some. -
Settled on the user’s delegation 2026-11-05 (built on branch
sysl-callbacks): passing Avin functions to Sysl, the choices the request left open:- The closure’s lifetime is Sysl’s: the shim’s closure captures a counted Sysl value with a
destructor that holds a root of the collector, so the root is given back when Sysl drops its
last reference to the closure. Why: Sysl closures already carry captured state and drop it, so
nothing has to be released by hand and nothing leaks while Sysl’s own ownership is right.
Alternatives: an explicit
releasethe library calls (leaks whenever it forgets, and frees a function Sysl may still call when it releases early); a root for the program’s whole run (leaks every callback ever given). - A callback belongs to the code that gave it by default;
@threadedon a binding’s parameter lets any thread call it. The default compares owners, as a handle’s use does, and traps on any other caller. Why: a callback’s captures are ordinary Avin objects, shared without synchronization, so a call from another thread is a data race unless the function is checked; most UI and event callbacks run on the thread that registered them. Alternatives: a flag on the whole binding,@sysl("name", threaded)(coarser: one binding may take two callbacks); reading&sync Fnfrom the Sysl signature (Avin does not parse Sysl types; Sysl’s check already refuses the unmarked case, and the refusal is reworded to name the mark). Review with the user: the spelling@threaded, and whether the default should be the owner (as built) or the OS thread. - What a
@threadedparameter is given is checked by its captures, since a function value is neverSendable: a top-level function, or a lambda, local function or method value whose every capture is avalor a parameter of a sendable type. A function value held in a variable or a parameter is refused (its type does not say what it captures), and a binding with a@threadedparameter cannot be used as a value, which would hide the call from the check. Alternatives: making function types carry a sendability mark (Sendablefunction types; a larger language change); no check (unsound). - A thread Sysl started itself is attached for a
@threadedcallback’s call (its own context, a fresh owner, the stack guard installed) and detached after; a callback without the mark called there traps without a place, since the thread never entered from Avin. Why: an audio or I/O thread of a C library is the common case, and attaching is cheap and safe since the thread holds no Avin references between calls. Alternative: always trap (makes such libraries unusable). - A callback made while its thread is in a blocking call makes the thread running for the call and safe again after; the place a trap in the library reports (the context’s caller site) is restored when the call ends.
- Settled on the user’s delegation 2026-11-05 (the director): a binding with a
@threadedparameter isblockingwhether or not it says so, since a Sysl call that may wait for another thread to call back would otherwise hold up that thread’s first collection for ever. Why: the deadlock cannot be detected, and the cost is two stores and two loads per call. Alternative: documenting that such a binding is declaredblocking(built first; a forgotten word hangs the program). A same-thread callback’s binding still blocks only where it says so. - A trap inside a callback stops the program at the callback’s own place. Avin traps report a place rather than a backtrace, so “with the Avin backtrace” is the trap’s place; there is no unwinding through Sysl frames, which would need Sysl to be unwind-safe.
- The program defines one C-convention entry per callback parameter (a bool as a byte), which
the shim declares
externand calls with the closure; the shim itself is generic in the Sysl types of the closure’s arguments, so a callback’s integer parameter takes any Sysl integer with the check a result has. Alternative: the shim calling the closure’s code directly through a function pointer (ties the shim to Avin’s internal convention forbool). - The runtime offers
avin.rt.callbacks_held, the number of functions Sysl holds, for tests and for libraries that want to check they release what they register.
- The closure’s lifetime is Sysl’s: the shim’s closure captures a counted Sysl value with a
destructor that holds a root of the collector, so the root is given back when Sysl drops its
last reference to the closure. Why: Sysl closures already carry captured state and drop it, so
nothing has to be released by hand and nothing leaks while Sysl’s own ownership is right.
Alternatives: an explicit
-
Settled on the user’s delegation 2026-11-05 (built on branch
sendable-spawn):Sendablewhere values cross threads today (what is shared). The actors chapter’s build order has no step for it; it applies the rule ofisolate‘s body, less the whole-program half, to threads and futures. Review with the user: it adds two annotations users can write.- The check is two marks on a parameter,
@sendableand@isolated, which any function may write. What is passed for@isolatedmay use only sendable values from around it: a lambda, a by-name argument, a local function or a method value by what it captures (its nested closures and the local functions it calls included), any other expression by the locals and parameters it reads; what it makes itself is its own.@sendableadds that a closure captures novar, whose box it would share with the code that made it. A marked parameter holding a function may be passed on for one with the same mark or a weaker one; an override may not add a mark or strengthen one. Why: the library’s thread entries are ordinary Avin functions, so a user’s wrapper ofspawnneeds the same spelling the library uses, and a mark on the parameter checks every call where the closure is written and its captures are known. Alternatives: a list of library functions known to the compiler (no user wrapper could pass a body on); a function type that says it is sendable (() -> Tthat isSendable), which would also let a sendable function be stored and sent, but makes function types carry a flag through unification and subtyping (later taken up as@sendablefunction types, under Proposed); no check, leaving the data race the memory model already makes harmless (the user’s direction is that threads share nothing mutable by default). - The bodies of
spawn,s.spawn,Future(body)andex.future(body), the functions of a future’smap,flatMapandonComplete, andorElse‘s by-name argument are@sendable. Their results are bounded bySendable, as areFuture.successful‘s value, aPromise‘s and the results ofmapOkandmapErr, so every future’s value is sendable however it was made. Alternative: boundingFuture[T]itself, which would make every generic function naming a future repeat the bound. - A
Mutexis sendable of any value, so its value is@isolatingwhere it is made (a buffer the caller keeps cannot be guarded),withiswith[R: Sendable](@isolating body: (T) -> R) -> R(the value cannot be returned or stored outside), andget,setandupdateexist only for a sendable value. Awithbody may assign the caller’svars of sendable types, since it runs at once on the calling thread. Why: without it,Mutex(b)orm.with(v -> v)hands the guarded buffer to code that changes it without the lock, which is the shared mutable state the mutex is the one door to. Alternatives:Mutexof any value unchecked, as written before; checking onlywith‘s result. The cost: a body cannot give back a fresh mutable value (nextByteson the shared random generator copies through a vector), and a generic body over an unboundedTcannot take its argument in (the shared generator’sshuffle,chooseandchooseWeightednow draw under the lock and pick outside it, with the same draws). Review with the user. - The standard library promises
SendableforThread[T]of a sendableT,Executor, a mutex’sCondition, andTcpStreamandTcpListener, which hold a Sysl handle and are handed over with it. AScopeis not sendable, so the trap on starting a scope’s thread from another thread is reached only through module-level state. - Tests that shared mutable data across threads were changed to share it safely: a scope’s
threads write
Atomicslots rather than an array; a flag and a once-initialized value becameAtomics; a vector built in avaris copied into aval; a test’s own byte array is made by each thread; a trait sent through futures promisesSendable; the run test of the scope trap became a rejection test; a test’sOncecounter became anAtomic; a test helper passing a function to its threads marks it@sendable. Command.lines()on a command holding a sequence starts the command on its driver thread, so the mutable job belongs to that thread alone, and learns through a promise whether it started; before, the job was made on the calling thread and handed to the driver. A startedChildand a lines iterator are mutable and not sendable; a thread starts and reads its own commands. Moving one would needIsolatedor a promise likeTcpStream‘s; a startedChildhas since been given the promise (proposed), and a lines iterator has not.
- The check is two marks on a parameter,
-
Settled on the user’s delegation 2026-11-05 (built on branch
fix-lone-value): A member call on the name of a data type whose variant of its own name has no fields (Lone.m(…)withdata Lone(); branchfix-lone-value). The name is both the type and a value of it. Proposed: where the type has a static member namedm, the call is the type’s and chooses among its static members alone; otherwise it is the value’s method, its trait methods and impl-added methods included. A method valueLone.mfollows the same order. Why: a static member can only be reached through the type’s name, while the value’s method is always reachable through a value, so giving the static the name loses nothing; and it keepsName.m(…)with a static member meaning what it means on every other type. Alternatives weighed: the value always wins (makes a fieldless type’s static members unreachable by name); choosing among the static members and the value’s methods together by parameter types (a call on a type name would then mix two kinds of receiver in one overload set, which nothing else in the language does); refusing a static member and a value method of one name on such a type (an extra rule for a rare case). The companion object needs no rule: it cannot share the name of a fieldless variant (declarations). -
Settled on the user’s delegation 2026-11-05 (built on branch
option-ord-fix): the polymorphic recursion check counts a cycle through a method an impl with bounds of its own adds only along the paths whose type argument’s outermost type may meet the bounds, that type’s own arguments taken as any type; a type argument whose outermost type the check does not know (a tuple, a function, a part taken apart from a larger type) counts as one that may. Why: the check must never miss a real cycle, and the outermost type is what the flow already tracks per path;impl[T: Ord] Ord for Option[T]otherwise made every program loading the threads library fail. Alternatives weighed: connecting the impl’s methods from the parameter as a whole (what it did: false cycles through types that never meet the bounds); tracking type arguments deeper than the outermost type (exact for nested shapes such as aBox[Box[Plain[T]]], which is still counted, at the cost of a much larger flow graph). Review with the user if a nested shape turns up in real code. -
Settled on the user’s delegation 2026-11-05 (built on branch
option-ord-fix): an ordering,<,<=,>,>=, settles an unknown in one operand’s type from the other’s, soSome(1) < Nonecompares twoOption[int]s, as==already did. Why: the two operands of an ordering are one type, so the other operand is the only evidence and the obvious one. Alternative: requiringNone[int], which==does not. -
Settled on the user’s delegation 2026-11-05 (built on branch
qualified-variants): Qualified variant access,Type.Variant(branchqualified-variants, 2026-11-05). Decided:T.Vandm.T.Vname data typeT‘s variantV, beside the bareV, in expressions and patterns; the variant comes before any other member of that name, and a companion object declaring a method or a field named after one of its type’s variants is refused where it is declared. A capitalizedT.Namethat is no variant, companion member or static member is reported with the type’s variants. Why: the qualified form is meant to be unambiguous, and refusing the companion member keeps it so, at the cost of a rule that only bites on a member spelled like a variant (members are lowerCamelCase, variants PascalCase). Alternatives weighed: the companion’s member winning (Shape.Circlewould then not always be the variant, defeating the point); choosing between them by call shape (a value and a call of one name meaning different things); allowing both silently with the variant winning (the companion member unreachable by name). A static trait member spelled like a variant is not refused, since the trait and the type are declared apart: the variant wins inT.V, and the member stays reachable through a type parameter. Type arguments are written once, on the type or on the variant, not both. Review with the user: whether the “capitalized name” test for reporting a missing variant should instead be any name that resolves to nothing on a data type. -
Settled on the user’s delegation 2026-11-05 (built on branch
thread-ownership): Every operation on a connection or a listener checks its socket’s owner first (branchthread-ownership). ATcpStreamkeeps the bytes it read ahead in Avin fields, so a read served from them alone never reached the socket, and the code that had handed the connection over read on from them without trapping; a closed connection or listener answered an error, and a listener’sport()its field, from any thread. Nowread,readLine,readAll,write,writeText,setTimeout,shutdownOutputandcloseon a connection, andport,acceptandcloseon a listener, first call a runtime method that does nothing on the open socket, or the socket’sclose(), which does nothing on a closed one: both check the owner, so the previous owner traps at every use, open or closed, and the new owner reads the bytes read ahead, which move with the connection. The owner check comes before a read’s size check. Why: the promise is that a connection belongs to one thread at a time, and a race on the read-ahead fields is exactly what it rules out. Alternatives weighed: dropping the read-ahead on hand-over (loses bytes the other end sent); a check in the compiler for every field of a class holding a handle (a language rule for what one library type needs); an Avin owner field compared by hand (it would not move when the runtime hands over, which moves only handles). -
Settled on the user’s delegation 2026-11-05 (built on branch
thread-ownership): A startedChildpromisesSendable, and moves between threads as a connection does (branchthread-ownership). It holds a runtime token, a handle holding nothing but its owner, andwaitFor,isAliveandkilluse it first, so handing a child to a thread’s or a future’s body makes it the body’s, the code that handed it over traps at any use while the body runs (`Child` belongs to another thread), and it comes back to the next user when the body returns. The body may wait for it, stop it and start a sequence’s later part. Why a token: a child’s own handles come and go (a program that has ended gives its handle back, a part not yet started has none, nor has one whose time ran out before it began), so none of them can carry the promise. Alternatives weighed:Isolated(not built yet, and a child is a resource handed over whole, as a connection is, not an object graph being built); keeping it not sendable, so that a thread starts and waits for its own commands (what it was; a server that starts a command and hands it to a waiter could not). A lines iterator stays not sendable: it is consumed where it is made, and the thread reading a command’s output can start the command itself. -
Settled on the user’s delegation 2026-11-05 (built on branch
thread-ownership): A handle class’s@syslmay name it for its traps:@sysl("avin.rt.Token", named: "Child")(branchthread-ownership; the director decided that the old owner’s trap names the type the user holds). Every trap a handle raises, belonging to another thread and being closed, in compiled code and in the shim, uses that name rather than the class’s; the name must be a type’s (a capital first, letters, digits and_), and nothing else about the handle changes. Why: the trap is read by the code that misused the value, which knows theChild, not the private token class inside it. Alternatives weighed: a token class of the same name in a module of its own (two types namedChild, which misleads a reader of the library); the trap text computed by the runtime from a name the token holds (the check is inline, one compare in compiled code, and its text is fixed when the program is compiled); naming the trap after the class whose method made the call (a rule no reader would guess).TcpStreamandTcpListenereach keep a handle class of their own over the one Sysl typesysl.net.Socket,named:for the type, so their traps name the type the user holds (branchsocket-trap-names); two handle classes may share one Sysl type. The other library handles (File,FdReader,Spawned,Address) are held only inside private library values whose own checks come first, so none is named further. -
Settled on the user’s delegation 2026-11-05 (built on branch
module-var-threads): a thread’s body reaches no module-level mutable state (what is shared). What is passed for a@sendableparameter, directly or through every function it reaches, reads and writes no module-levelvarand reads no module-level value,lazy valorobjectwhose type is not sendable. Reached means: the function a call names; for a call through a method table or a bound, every method of that name in that slot of any type’s table; for an operator on a value that is not a scalar, every implementation of the trait method it calls; every closure and function value made along the way; and the code a pattern runs (an extractor’s method, a sequence’s length). The error names the module-level item and the functions it is reached through, shortest path first. Why: a module-level value is reached by name, not captured, so the capture rule of@sendablenever sees it, and a body that bumps a module-level counter races withmain. Avin compiles the whole program, so what a call can reach is known, asisolate‘s check of its body already assumes. Alternatives: no check (the memory model makes the race harmless to the collector, but the threads chapter promises that threads share nothing mutable but the synchronized types); rejecting only what the body names itself (misses every call, so it closes nothing); per-thread copies of module-levelvars (a different meaning for one declaration depending on which thread reads it); and treating each module-levelvaras an implicitAtomic(hides a lock in every read and does not make a read-modify-write atomic).- The whole argument counts, not only the closure:
spawn(makeBody())is checked throughmakeBodyand every closure it makes, since what runs on the thread is whatever it gives back. The cost is a rejection where a call evaluated at once on the calling thread reads avarto choose the body. Alternative: following only closures and function values, which misses a body returned by a call. - A call through a trait method or an operator counts every implementation in the program, since
which one a value has is not known where the body is checked. The cost is a rejection where one
implementation reads a module-level
varand the body never meets a value of that type. Alternative: following the receiver’s static type only where the class is final, which is finer but has to agree with devirtualization. - Settled on the user’s delegation 2026-11-19 (branch
reach-chains): what a call through a method table, a bound or an operator reaches follows the types its receiver may have. On a data type it is that type’s own method; on a class, that class’s and its subclasses’; on a built-in scalar, nothing of the program’s; on a trait or a type parameter, the method of that name of every type conforming to the trait or to the parameter’s bounds; onAny, every one, as before. A generic function or method is followed instance by instance: called at known type arguments (or a method on a receiver of known type arguments), its operators and bound calls on its type parameters reach only what those types implement, and a lambda runs in the instance that makes it. An equality on a type with anequalsof its own reaches that; one without compares fields and elements and still reaches everyequals. Why: the rule above counted every method of the name in the program, so a program’simpl Sub for Moneyreading a module-levelvarmade the standard library’sBigIntsubtraction, and with itMap,Futureandprintln, look as if they reached it: a thread’s body was rejected through chains no value could follow. Every narrowing keeps every implementation a value of the type can really have, so nothing the check closed is reopened (thread_module_reach_generic.avinpins the reachable routes). Alternatives: keeping the name-wide rule and deduplicating the chains (still rejects correct programs); a flow analysis of which types each generic class is made with, which would also see that anIterator[Any]inprintlnnever yields a program’s type (much larger, and an instance whose arguments are not known still stands for every instance); narrowing by bounds alone, without instances (leavesMap[int, …]reaching everyhash). Review with the user: a code path through a trait-typed value whose type arguments are not known still reaches every conforming type’s method, so a program whose ownHashorEqreads a module-levelvarstill sees library code rejected in a thread’s body (printlnreachesHashSet.containsthrough anIterator[Any]). - What is passed for an
@isolatedparameter is not held to this, since it runs at once on the calling thread. AMutex‘s value andwithbody were@isolated; they are now@isolating, which is held to it (see themutex-isolatingentry below). - Printing stays legal with no promise:
print,println,eprintlnand theStandardOutputandStandardErrorobjects reach the runtime’s streams, which keep no state in Avin, and the objects hold no field. The standard library’s own module-level state is held to the rule like a program’s: the futures’ worker registry, guarded by its lock, promisesSendable, as do the regex library’s Unicode run tables (arrays filled before the table is made and never written after), and so does theAnnotationtrait, since a type’s shape is one module-level value every thread may read (an annotation type holding a mutable field is now rejected where it implements the trait). A collection’s companion object (Array,Buffer,Deque, the mutableMapandSet) is sendable like any object with no field; only the collections themselves are mutable. Review with the user: whether theAnnotationpromise is wanted, and whether the trait and operator over-approximation rejects too much in practice.
- The whole argument counts, not only the closure:
-
Settled on the user’s delegation 2026-11-05 (built on branch
lambda-untupling): A lambda takes a tuple apart by its parameters (tuples; branchlambda-untupling). Where a function of one parameter whose type is an n-tuple (n ≥ 2) is expected, a lambda of exactly n parameters binds the tuple’s elements in order, each typed from its element; a declared parameter type must fit its element (a wider one is accepted, as for any lambda parameter), and an element the expected type leaves unknown takes its declared type._binds nothing; an inner tuple is one element. It applies only where the lambda’s parameter count does not fit the expected function directly, and among overloads a candidate that needs it is chosen only where none takes the lambda as written (Map.map((k, v) -> …)stays the two-parameter overload). A count fitting neither shape is an error naming both. Why:xs.zip(ys).forall((x, y) -> x == y)is the natural spelling and was rejected, leaving onlymatch (x, y) -> …, a pattern where two names suffice; the reference language takes tuples apart the same way. Alternatives weighed: keeping thematchfunction as the only way (no new rule, but the common case pays for a pattern); allowing a pattern in any lambda parameter position,((a, b), c) -> …(more general, but a second pattern syntax beside thematchfunction, which already covers nested and refutable shapes). -
Settled on the user’s delegation 2026-11-05 (built on branch
iterable-size): everyIterablehassize(),knownSize()andsizeCompare(n)(collections), following the reference library:size()counts by iterating unless a collection overrides it with its own count,knownSize()is the count where it is known without iterating and -1 otherwise (aListother thanNil, an iterator, a view), andsizeCompare(n)answers -1, 0 or 1, reading at mostnelements when the count is unknown. Sequences havesize()andlength(), equal. They are overridable trait members rather thanimplmethods, so a call throughIterable[T]reaches the collection’s own count. Consequence: a class implementingIterablethat declares its ownsize,knownSizeorsizeComparemust mark itoverride. Alternatives weighed: an arbitrary-signsizeCompare(the reference library’s contract, but -1/0/1 is what every caller tests);length()on everyIterable(left to sequences, whose length is their defining measure);sizeIs(needs special syntax). Review with the user: theoverriderequirement on existing user classes. -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-binding): A callback’s integer answer goes into whatever integer the closure Sysl takes answers, with a check (Sysl bindings). An Avin function answering alongor anintreaches a Sysl closure answering any integer,u32,u64andusizeamong them, and an answer the Sysl type cannot hold stops the program where the binding Sysl is running in was called, naming the type by sign and width (value out of range for u32). Why: Avin has no unsigned integers (settled 2026-11-02), and syslui asks for a colour by&Fn() -> u32; the answer is the mirror image of an integer result, which already takes any Sysl integer, so one rule covers both directions of a value Sysl reads, and a narrower signed answer is the same case. A closure answering a generic Sysl function’s type parameter names no integer, and answers the binding’s own type; the compiler learns that from Sysl’s refusal to infer one and builds the shims once more. Alternatives weighed: anintreinterpreted as theu32‘s bits (a colour past0x7FFFFFFFwritten negative, and a reader never sure which); refusing the binding (no window could be given a colour); converting only into unsigned types (two rules for one shape). Built onui-binding. -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-binding): The user interface binding is the packageui, inpackages/uiof this repository, rather than a module of the standard library (User interfaces). Why: no package may declare a module underavin, the standard library carries no Sysl dependencies, and a program that does not draw should neither build syslui nor link SDL3; a domain library is a package of its own (packages). Alternatives weighed:avin.uiin the standard library (needs the library to name Sysl packages and every program to link SDL3); a repository of its own (premature while the binding and the language move together). Built onui-binding. Review with the user: the nameavin.uiwas the plan’s, and only the standard library may hold it. -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-binding): The binding is thin and keeps syslui’s shapes (User interfaces). Each syslui function is bound under its Avin name with syslui’s defaults restated; a view is one handle class on the trait; one signal class for each instance a control takes (IntSignal,RealSignal,BoolSignal,StringSignal);slideris one overload forintand one forreal;Role,Variant,TextStyle,MissKind,MissedandRectare mirrors. The package’s one function of its own istap(v, key, at), the draw, snapshot, press and release a test of an interface makes every time. Why: the component and signal layer, which is Avin’s, decides the shapes an application writes; this layer only has to reach syslui. Alternatives weighed: a generic signal class (Avin binds a handle at one instance); wrapping every binding in a private one (no name to change yet). Built onui-binding. -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-binding):runisblocking, and no ui callback is@threaded(User interfaces). The frame loop waits for events for most of its life, so the thread is safe for the collector meanwhile, and syslui-sdl calls the tree, the ground and every control’s callback on the thread that calledrun. Alternatives weighed: an unmarkedrun, which would hold up every other thread’s collections for the life of the window. Built onui-binding. -
Settled on the user’s delegation 2026-11-05 (built on branch
unicode-identifiers): Names in any script (branchunicode-identifiers, 2026-11-05; names). A name starts with a character of Unicode’sXID_Startor_and continues withXID_Continue(UAX #31, the Unicode identifier rule), at the Unicode version the compiler’s tables were cut from (17.0.0). Why: domain vocabulary is written in the programmer’s own language, and the XID properties are the ones designed to be stable under normalization and across Unicode versions. Alternatives weighed: ASCII only (what the lexer had; refusesgrößefor no reason a reader could guess); any non-ASCII character that is not a space (admits emoji, arrows and operators of other scripts, soa→bwould be one name); General_Category letters, marks and digits (Sysl’s rule; close to XID but not stable under normalization, and admits pattern characters such as U+2E2F). -
Settled on the user’s delegation 2026-11-05 (built on branch
unicode-identifiers): A name in a normal form other than NFC is an error, with its NFC spelling (branchunicode-identifiers). Why: every name stays byte for byte the text written, so spans, rename, lookup and emitted symbols need no second spelling, and two spellings that look identical can never be two names, which is what normalizing would also guarantee. Alternatives weighed: normalizing to NFC silently (friendlier to an input method that writes decomposed text, but every name then has a spelling the source does not contain); no normalization (Sysl’s choice:caféandcafewith U+0301 are two names that look the same); NFKC (foldsfiintofiand full-width letters into ASCII, which changes what a name visibly is). A module’s directory name is held to the same rule. Review with the user: whether silent normalization is preferred. -
Settled on the user’s delegation 2026-11-05 (built on branch
unicode-identifiers): Capitalized means an uppercase or titlecase first letter (Lu,Lt); a caseless letter is not capitalized (branchunicode-identifiers). Every place the compiler asks whether a name is capitalized (a missing variant writtenT.V, a scalar type’sMaxValue-style constants, a missing type in an import of a library module, a handle’snamed:, the highlighting of types) uses this test, soÄrger,ΔeltaandDžemalread as type-like names and名前as a value’s. A bare name in a pattern is a variant when one of that name is in scope and a binding otherwise, whatever its case, so a caseless name is a binding unless it names a variant. Why: a caseless script has no way to write a capital, and treating its names as lowercase keeps them usable for the commonest names (values, functions); its types are still declared and used by name. Alternatives weighed: caseless counting as capitalized (every CJK local would read as a constructor-like name); refusing caseless names where a capital is expected (a CJK program could not name a type). Review with the user: this is the choice most likely to matter to a program written wholly in a caseless script. -
Settled on the user’s delegation 2026-11-05 (built on branch
unicode-identifiers): Look-alike names in different scripts are different names, with no warning (branchunicode-identifiers): Latinaand Cyrillicаare two names. Why: confusable detection (UTS #39) needs data the compiler does not carry and warns on legitimate mixed-script code. Alternative: a mixed-script warning per name. Review with the user if spoofed names in shared packages become a concern. -
Settled on the user’s delegation 2026-11-05 (built on branch
unicode-identifiers): A character above ASCII that begins no token is reported with its code point and stepped over whole (branchunicode-identifiers): an emoji is “not a character a name or an operator is spelled with”, and a digit or mark of another script where a name begins “cannot begin a name”, each naming the character and itsU+code point. Why: the bytes of one character used to be read as separate symbols, which the parser then reported one at a time. -
Settled on the user’s delegation 2026-11-05 (built on branch
sendable-functions):@sendablefunction types, answering the open question whether a function value can be sent, with a type that says what it captures (function types, what is shared).@sendable (A) -> Bis a function type whose values capture only sendable values and novarand reach no module-level mutable state; it isSendable, and a plain function type is not. Only a function type may carry the mark.- A lambda, a function reference or a method value written where a
@sendablefunction type is expected is made as one, and is checked there by exactly the checks what is passed for a@sendableparameter gets: its captures, and the whole-program reach of module-level state. The error names the type (a `@sendable (int) -> int` may use only sendable values …). Any other value of a plain function type is not one, and the mismatch says why. @sendable (A) -> Bis a subtype of(A) -> Bwith no conversion: in covariant positions (a vector’s element, a result, an override’s result) too, not through an invariant one (an array’s element). Two branches of the two types agree on the plain one.- A parameter marked
@sendablethat takes a function holds a value of the@sendablefunction type inside the function, so the mark and the type are one notion seen from the two sides; the parameter’s declared type is unchanged, so an override that drops the mark still overrides. Passing a value already of a@sendabletype tospawnor any marked parameter is accepted as it is. - Data and classes whose fields are
@sendablefunctions are sendable by the existing structural rules, at every type argument of a generic one (aParser[T]holding a@sendable (Input) -> Option[T]), so module-level parser grammars,lazy vals among them, pass the module-state check and run on spawned threads. - Two overloads that differ only in whether a function parameter is
@sendableare one overload (refused as declared twice), as two differing only in a by-name parameter are, since one lambda may be passed for either and overload resolution runs before the sendability check. - An override’s parameter types match its method’s exactly, the mark included; its result may be
the
@sendablesubtype. - Why: the parsing library’s grammars are module-level values holding functions, and could not
be used from a thread at all; the
@sendableparameter mark already decides exactly what a function value may capture and reach, so the same check at the point a value is made lets the type carry the guarantee through storage, fields and module-level values, soundly, and the spelling reuses the mark readers already know. - Alternatives: inferring capture sendability into every function type with no mark (every lambda’s type would depend on its body, unification and overloads would see two function types per signature, and an API could not promise it); effect-style capture sets in the type (precise, but a large addition to the type system for one property); leaving functions never sendable (sound, but module-level grammars, handler tables and task lists stay unusable from threads).
- Review with the user: the spelling
@sendable (A) -> B(an annotation in type position, the only one), against a keyword or aSendable-bounded spelling; and whether two overloads differing only in the mark should be refused or resolved to the plain one for a lambda.
-
Settled on the user’s delegation 2026-11-05 (built on branch
state-machines): State machines, the choices the chapter leaves open (branchstate-machines, 2026-11-05). A machine is read into itsDoor.Statedata type and a final class holding the current state, so it needs no runtime. Decided:- Order inside a transition. The arm runs first; then the current state’s
leave, in whichstate()still answers the state being left; then the new state is current and itsenterruns, in whichstate()answers it;handleanswers the state afterenter. Why: an arm computes where to go,leavecleans up the old state’s data, which it can still read, andentersees the machine as it will be. Alternatives: switching the state beforeleave(it would then read data no longer current); runningleavebefore the arm (an arm yieldingstaywould have left). - A state is a variant of its module, as every data type’s variant is:
Locked(code)anddoor.state() is Locked(_)name it bare. Why: it follows fromDoor.Statebeing an ordinary data type matched by bare names, as the chapter writes. Alternatives: scoping state names to their machine, written bare only inside it andDoor.State.Lockedoutside (the chapter’s owndoor.state() is Locked(_)would no longer read). Amended (Proposed, branchshared-variants, below): two machines of one module may now share a state’s name, and a state an event’s variant, each bare use decided by the type expected there, as for every shared variant name; until then a state’s name had to be one no other variant of the module had. Door.Statetakes all of the machine’s type parameters, with their bounds, so a state of a generic machine may hold values of them:Cell.State[string]. Why: the smallest rule that lets any state hold any of them. Alternative: only the parameters the states use (the type’s arguments would then depend on which states mention which parameter).stayis the value of an arm where it is the arm’s value: the arm’s whole body, the last line of a block, and each branch of anifor amatchthat is itself in such a place. Elsewherestayis an ordinary name. Why: the chapter makesstaya keyword only as an arm’s value. Alternative: anywhere in an arm’s body (it would then be a value that could be stored, with a meaning only at the end).- The trap on handling from inside a handler names the machine and is reported at its
declaration:
avin: trap: `Relay` handles an event from inside one of its own arms, `enter` or `leave` blocks at file:line:col. The first state’senter, run as the machine is made, is such a block too. Why: the check is in the code the declaration makes. Alternative: reporting thehandlecall that re-entered, as a library trap reports the program’s call (it needs the machine’s code to count as the library’s for its traps, which its arms are not). - The coverage error lists every case left out: each variant of the event type not covered in
full, written as its first uncovered value (
Lock(_),Both(true, None)), followed by “where the guard is false” when a guarded arm could have taken it; for an event type without variants, one value (-1). Why: it is the chapter’s own message, extended to the shapes it does not show. - A machine takes no parents and no
derivesin its header in this step, and a state and thereceiveblock takeelsearms as amatchdoes. Alternative: parents after the parameters, as a class’s; nothing in the chapter needs them yet. - Handling an event from the machine’s own body, before the first state’s
enterhas run, is allowed: the machine is in its first state then. Alternative: trapping as from inside a handler. - Not sendable, said as such: a machine passed where a sendable value is needed is reported as “a machine, a mutable object that moves between its states”, not by its hidden state field.
- Order inside a transition. The arm runs first; then the current state’s
-
Settled on the user’s delegation 2026-11-05 (built on branch
ui-int-params): A binding’s integer parameter goes into whatever integer the Sysl parameter is, with a check (Sysl bindings). An Avinint,long,i8ori16parameter reaches a Sysl parameter of any concrete integer type,u8tou64,usizeand the signed widths, converted in the shim; a value the Sysl type cannot hold stops the program where the binding was called (value out of range for u32). A handle’s method converts the same way, and a blocking call converts with its thread safe for the collector, making it running again before stopping the program. Why: syslui’s colour modifiers take au32parameter, Avin has no unsigned integers (settled 2026-11-02), and the rule is the mirror image of the integer result and the callback answer, so all three directions of an integer follow one rule. Consequence: alongnow reaches ani32parameter where its value fits, which was rejected before. Alternatives weighed: converting only into unsigned types (two rules for one shape); anintreinterpreted as theu32‘s bits (a colour past0x7FFFFFFFwritten negative). -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-int-params): An integer parameter is passed as the Avin type itself where Sysl cannot infer a type for its conversion: a parameter whose Sysl type is a type parameter of a generic function (same[T](x: T)), and every integer parameter of a binding whose call left any type argument uninferred (syslui’sslider[T](value: &Signal[T], lo: T, hi: T), where the integer bounds decideT). The compiler learns this from Sysl’s refusal and builds the shims once more, as it does for a callback’s answer. Why: a conversion needs a target type, and a generic parameter has none until its arguments say. Alternatives weighed: converting the parameters a generic call can still infer and passing only the stalled ones as they are (needs a build per round of refusals); refusing such bindings (sliderwould be unbindable). Review with the user: a binding to a Sysl function overloaded only by integer width now reaches the overload Sysl picks for an uninferred integer argument, rather than the one matching the Avin type exactly; no binding does this today. -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-int-params): An integer anOption, aResult, a tuple or a collection parameter holds is not converted, and the binding is rejected with a sentence saying so. Why: the conversion functions for these shapes are shared between bindings and spelled with the Avin type’s Sysl spelling; making each generic in its integers would make every nested parameter an inference problem, for no binding that needs it yet. Alternative: converting them as results are converted (the shape is there, the need is not). -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-int-params): A colour inuiis anintholding0xRRGGBB, as syslui draws it, withrgb(r, g, b),mix,lightenanddarken(User interfaces). Why: syslui has no alpha, so a0xRRGGBBAAwould carry a channel nobody reads; every colour fits anint, which is what a hex literal is by default; and a binding’s parameter cannot take an Avin data type, so aColortype would need a wrapper around every modifier. Alternatives weighed: along(whatapp‘sgroundanswers, but wider than any colour); aColordata type withrgb/rgba(a wrapper per modifier, and an alpha syslui ignores). Review with the user:app‘sgroundstill answers along; it could become anintto match. -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-int-params): A value narrower than 32 bits crosses the boundary widened as the C convention says: Avin marks a shim’si8andi16parameters and a callback’s narrow signed answersignext, and a byte or boolzeroext, which Sysl relies on. This fixes a bug: a negativei8ori16computed at run time reached Sysl as a large positive value (-5as65531). Alternatives weighed: passing every narrow integer as ani32and narrowing in the shim (changes the type a generic Sysl parameter infers). -
Settled on the user’s delegation 2026-11-05 (built on branch
sendable-params): a@sendableparameter is sendable inside its function, whatever its type (threads). Found by the parsing library, whose combinators take a@sendable f: PartialFunction[char, U]and could neither capture it in a@sendablelambda nor pass it on.- Inside the function the parameter is sendable: a
@sendablelambda captures it and it is passed on for another@sendableparameter without a check. Why: what is passed for it was checked where it was passed, as a function-typed parameter’s already was. - What is passed for one that does not take a function is itself sendable: a
matchfunction written in place (the core library’sMatchPartialFunctionof two lambdas, checked by what the arms capture and the module-level state they reach), a value of a sendable type, a parameter so marked, or a class’s markedvalparameter. Any other value is refused, where before a fresh object (what it makes itself is its own) passed. Why: the value is now shared by whatever the function hands it to, so a fresh object with avarfield would be shared between threads. - The mark belongs to the parameter, not to its type (the sound minimum): a marked value copied
into a local, stored in a data field typed as the trait, combined (
f.orElse(g)), or passed for an unmarked parameter bounded bySendable, is a value of the trait’s type again, which is not sendable. A class’svalparameter marked@sendableis a field whose value is sendable, so it leaves the class sendable by its structure; avarone does not. Alternatives: a@sendablemark on trait types (@sendable PartialFunction[A, B]), which would carry the property through locals and fields, or marked data fields; both are new type-system surface, and can be added later without breaking what this allows. Review with the user: whether@sendableshould become a mark on trait types, as it is on function types. - A lambda or a
matchfunction passed for a type argument bounded bySendable(^^^[U: Sendable](value: U)) is made as a@sendablefunction and checked as one where it is made; where the expected type decides that argument as a plain function type, it is taken as its@sendableform, which conforms to the plain one. Why: a plain function type is never sendable, so the call could not succeed otherwise. Alternative: requiring the type written,^^^[@sendable (int, int) -> int](…), which is noisy for every operator parser. Amatchfunction where aPartialFunctionis expected is not changed by the bound: it is aPartialFunction, which does not promiseSendable.
- Inside the function the parameter is sendable: a
-
Settled on the user’s delegation 2026-11-05 (built on branch
mixed-lambda-inference): the lambdas andmatchfunctions of a call are checked in turn, each the first in the call whose parameter types are known (generics): declared by it, or decided by the arguments checked so far; where none is, the first one left is checked and reports what it cannot infer. Found as a bug: they were checked strictly left to right after the other arguments, soboth(match n -> n + 1, (x: int) -> x * 10)forboth[A, B](g: (A) -> B, f: (A) -> B)failed with “cannot infer the type of the value thismatchmatches”, as did an untyped lambda written before the typed one, while the same arguments swapped were accepted. Why: the smallest rule under which argument order does not matter for what can be inferred, and every call accepted before is checked in the same order as before (each lambda it checked was already the first ready one). Alternatives: keep left to right (order-sensitive, as the bug shows); check the lambdas with declared parameters first, then the rest left to right (misses chains, where amatchfunction’s type comes from an untyped lambda’s result); or solve all of them together as constraints, checking each body against partly unknown parameters (a larger change, with diagnostics harder to place). Review with the user: the order rule is visible in which calls infer, so a later constraint solver would be a language change. -
Settled on the user’s delegation 2026-11-05 (built on branch
sendable-followups): three follow-ups to@sendableparameters (threads, callbacks). They amend thesendable-paramsentry above where it says a combination, and amatchfunction where aPartialFunctionis expected, are not sendable.- A binding’s
@threadedparameter takes a value of a@sendablefunction type and a parameter marked@sendableas they are, and a lambda passed there may capture a marked parameter. A plain function value, an unmarked or@isolatedparameter, and an unmarked parameter captured stay refused. Why: each was checked where it was made or passed to be what any thread may run, which is all the@threadedcheck asks. Alternative: none sound is narrower; requiring a lambda around it (x -> f(x)) is the contortion this removes. f.orElse(g)is sendable wherefandgare, by a promise the standard library writes on the method,@sendable_result: a call of a function so marked is sendable where its receiver and every argument are amatchfunction written in place, a value of a sendable type, a marked parameter or class field, or another such call; chains oforElsefollow. The promise is refused outside the standard library, since nothing checks it against the body, and a call that names the method statically reaches no override. A combination held in a local is aPartialFunctionagain, as a marked parameter copied into one is. OnlyorElsemakes the promise:liftanswers a function whose captures a program’s ownPartialFunctionimplementation decides, andapplyOrElseanswers a value, not a partial function. Alternatives weighed: a general rule that any call whose parts are sendable is sendable (unsound: the call may answer a fresh object with avar, or reach module-level state); a conditionalSendableimpl forOrElsePartialFunction(the result’s static type is the trait, which no impl of the class reaches); hard-codingPartialFunction.orElsein the checker (the annotation says the same and names its users); a@sendablemark on trait types, under review in the entry above, which would subsume this. Review with the user: whether a program’s own combinators should be able to make the promise, checked against the body (a body that only builds an object of a final class from its parameters).- A
matchfunction where aPartialFunctionis expected, passed for a type argument bounded bySendable, meets the bound, as a lambda there does: its two lambdas are made as@sendablefunctions and checked where they are made, the one running its arms holding every pattern, guard and body, so a fault is reported once.PartialFunctionitself does not promiseSendable, so the bound is waived at that call only where every value the call gives the callee of the type argument is such a function: each parameter whose type could give one (any position but what a function passed takes, a data type’s or a class’s argument counted whatever its variance) is of exactly that type and given such a function. A written type argument is held to the bound as written, astake[(int) -> int](…)is. Why: the callee obtains values of its type argument only from its arguments, each of which was checked. Alternatives weighed: a sendable form of thePartialFunctiontype (the trait-type mark under review above); makingMatchPartialFunctionpromiseSendable(it holds two plain function fields, which are not sendable, and amatchfunction’s static type is the trait anyway).
- A binding’s
-
Settled on the user’s delegation 2026-11-05 (built on branch
ui-components): Interface state is a generic Avin classState[T], withget,setandupdate(f), and a set is one write: aninvalidate()for a state held in Avin, or a write of its signal for one a control has linked (components). Why: the state lives in Avin, so it holds any type; making the set the frame loop’s write means nothing else has to be called after one, and a set is counted exactly as a signal’s is. Alternatives weighed: syslui’s own signals for every state (only four instances exist, so a list or a data value could not be state); a set that skips the write when the value is unchanged (needsEqon everyT, and a function or a class has none). -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-components): A control over a state reads and writes the state’s own signal, made once byState.signal(s), which is from then on where the value lives, rather than a second copy kept in step. Why: one place for the value means a control’s write is the state’s value at once, with no build in between, and no write can echo back into the other side, so there is no loop to break. Alternatives weighed: a bridge copying both ways at each build, comparing against the last value it saw (stale between a tap and the next build, and a conflict to resolve when both change); a callback from syslui on each write (not in the binding). The controls taking aStateare overloads of the binding’s own (switch,checkbox,radio,radioGroup, bothsliders,textField,textArea,tabs,scroll). -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-components): Components are functions returningView, writtencomponent c -> …orkeyed(key) c -> …; what a component keeps across builds is asked of itsScopeby order (c.state(init),c.remember(make),c.derived(f)), and a component is found again by its place among its parent’s unkeyed components, or by its key. A build is a call of the functionroot(body)answers; a component the build of its parent leaves out is dropped with everything inside it. Why: a component stays a plain function of its arguments, so props are ordinary parameters and need no class; reified type tests make the positional slots sound (a slot asked for as another type stops the program rather than being misread); the scope is a parameter, so a request outside a component cannot be written by mistake. Alternatives weighed: a class per component with fields as state (props would have to be copied into an instance kept from an earlier build, and every component would need a class and a table of instances by type); a state machine per component (fits a component with modes, not one holding a value); a scope passed from parent to child explicitly (every call of a component would carry it). Review with the user: the shape of the API, and whether keys should be anyHashvalue rather than astringor anint. Review with the user: the component API’s shape, and whether keys should be anyHashrather than a string or an int. -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-components): The mistakes the order and the keys can make stop the program: a component built with no root building, two components under one parent with one key, a slot asked for as another type than the last build’s, a scope asked after its build, and a root built inside its own build. Why: each would otherwise give one component another’s state silently. Alternatives weighed: starting the slot or the component afresh (hides the mistake), a warning (Avin has no runtime warning channel). -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-components):derived(f)computes again only after something has been written since its last computation, by the counterwrites()answers, rather than by the states it read. Why: every state, signal andinvalidate()moves the counter, so it is never stale where the frame loop would rebuild, and it needs no record of whatfread. Alternatives weighed: tracking the states read duringf(finer, but a hidden global and a cost on everyget), computing on every call (no use as a value of its own). -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-components): The interface’s state belongs to the thread running it, and the type system keeps it there: aState, aDerivedand aScopeare mutable, so not sendable, and a closure for another thread cannot capture one. There is nopostorrunOnUiyet. Why: the frame loop’s write counter and syslui’s signals are not synchronized, so the only sound cross-thread path is a queue the frame loop drains, and nothing in the binding wakes the loop from another thread. Alternatives weighed: a sendablepost(@sendable f)queuing a change (its function could not capture the state it is meant to change, so it would need a sendable handle to a state, a design of its own). Review with the user: a worker reporting to the interface needs that handle and a way to wake the frame loop. Review with the user: the path from another thread, which needs a sendable handle and a way to wake the frame loop. -
Settled on the user’s delegation 2026-11-05 (built on branch
ui-components): An example program is one package, so the to-do example isexamples/ui-todobesideexamples/ui, since the corpus builds each directory ofexamplesas one program with onemain. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-runtime): A behaviour’s library form isBehaviour[M](name: string, start: @sendable (ActorRef[M]) -> (M) -> unit)(declaring an actor). The start runs once on the actor’s first turn, is given the actor’s own reference (self), makes the actor’s state in its locals and gives back the handler of each message;actordeclarations will lower to exactly this, the name being the declaration’s. Why: it is the smallest value that holds “the declaration and its arguments” and can be started again for a restart, and making the start a@sendablefunction puts the existing capture and module-level-state checks on everything an actor’s body reaches, with no new check. Alternatives weighed: a trait with areceivemethod implemented by a class per actor (the state would be an object the program sees, which the spec rules out); a constructor hidden from programs (then the runtime could not be tested before declarations exist, and a program could not build an actor from a function). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-runtime):Executor.execute(task)runs a task on the executor’s workers with no future, as an owner of its own with nothing handed to it, and runs aftershutdownas a future’s functions do (executors). Why: an actor’s turns are queued on its executor again and again, andavin.actorscannot reach the pool’s module-private queue; the pathfuturetakes hands over by walking everything the task reaches, which for an actor is its whole state and mailbox at every turn. Alternatives weighed: puttingavin.actorsinsideavin.threads(the spec names the module); walking at each turn (cost grows with the actor’s state); a compiler-known hook visible only to the library (new machinery for one call). Review with the user: it adds a public method whose owner rule (handles the giver owns trap in the task) differs fromfuture‘s. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-runtime): Scheduling details (scheduling). An actor’s number is one sequence for the whole program, from one in the order actors are spawned, not one per declaration.spawnhands the Sysl handles its behaviour reaches to the actor, as a thread’sspawndoes with its body. The start runs in the first turn and is not one of the 16 messages; a turn ends early when the mailbox is empty; an actor on an executor that has been shut down goes on handling what it is told, sotellnever fails. Why: each is the smallest rule that keepstellfrom waiting or failing and keeps a handle usable by whoever runs the actor. Alternatives weighed: numbers per declaration (Counter#1,Logger#1; needs a registry of names); dropping messages to an actor whose executor is shut down (a silent loss the spec does not ask for). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-declarations): Anactordeclaration is read into a function and a hidden class (declaring an actor).actor Counter(start: int) receives Mis the functionCounter(start: int) -> Behaviour[M], with the parameters’ defaults, and a private class holding the actor’s reference, the parameters and the body’s fields and methods, whose name (actor Counter) no program can write. The start of the behaviour makes one object of that class, which runs the body, and gives back the call of itsreceivematch; inside the bodyselfreads the reference. Why: it lowers onto the library’sBehaviourwith no runtime support, as the chapter says a declaration is, and the class gives the body’s methods the implicit receiver and its fields their life across messages for free, while the object never becomes a value the program sees. Alternatives weighed: the body’s fields as the start lambda’s locals and its methods as local functions (no implicit receiver, and forward references between methods break); a runtime-known actor class (machinery the runtime does not need). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-declarations): What an actor’s parameters may be. Each parameter’s type is held toSendablewhere the actor is declared, not where the start captures it, so the error names the actor and the parameter; one the program marks@sendableis exempt, as a marked parameter of a function is sendable inside it whatever its type. Avarparameter is a field the actor may change, each start beginning again from the argument; a repeated parameter is allowed; a by-name one is refused. An argument is checked only by its type, soWorker(s"$label$made")computed from an actor’s ownvaris accepted. Why: the chapter says the parameters follow a class’s rules and must be sendable; this is the reading that adds no rule of its own. Alternatives weighed: marking every parameter@sendable(then an argument computed from avaris refused, since what is passed for a marked parameter is checked by what it reads); refusingvalandvarparameters (no gain: nothing outside the actor reaches its fields). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-declarations): An actor’s diagnostics name the actor. A message type that is not sendable is reported once where it is written afterreceives(`Buffer[int]` does not conform to `Sendable`, so the actor `Buffers` cannot receive it), not once for the behaviour and once for the reference; areceivethat does not cover the message type saysactor `Partial` does not handle `C`and how a message is ignored; module-level state reached from the body, an arm or a method isthe actor `Arm` may run on another thread, the path naming the actor’s methods by their own names; a method value carrying the state isthe state of the actor. Why: the program wrote an actor, not a behaviour and a lambda. Alternatives weighed: the generic messages of the@sendablestart (they name a function type the program never wrote). Review with the user: the hidden class is spelledactor Counter, with a space, so it reads well where a diagnostic names it. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-lifecycle): An actor’s lifecycle is the classActorContext[M]its state extends (lifecycle).stop,watch,unwatch,after,every,children,parentandonStoppingare methods ofavin.actors.ActorContext[M], made from the actor’s reference; the hidden class of anactordeclaration extends it, so the body, arms and methods call them as their own, and a behaviour written as a library value makes one in its start,ActorContext(me). Each finds its actor through the runtime’s table of running actors by the owner of the code running, and traps where that is not the actor (made bymain, or called from a future). A field or method of an actor with the name and parameters of one of these is refused (`stop` is one of every actor's own methods), and the body may call them before its own fields are initialized, since they reach only the context’s. The same table givesspawnthe actor whose code is running, its new child’s parent. Why: the chapter writesstop()andafter(…)bare inside an actor, typed by the actor’s message type, and inheritance gives exactly that with no new lookup rule, while the library form keeps working with no declaration. Alternatives weighed: changing a behaviour’s start to take the context instead of the reference (every library-form behaviour changes, andmeis no longer a reference); free functions finding the running actor (aftercould not be typed by the actor’s messages); names the checker resolves specially inside actors (a lookup rule of its own, and nothing for the library form). Review with the user: the public nameActorContextandonStopping, and that an actor’s own names now includechildrenandparent(a test’s fieldchildrenwas renamed). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-lifecycle): Stopping, the cases the chapter leaves open.stop(self)isstop(); stopping an actor that has ended does nothing, whoever started it (there is no actor left to protect, and the end may have raced the call); an actor asked to stop before its first turn still runs its body first, so itsstoppingblock always has state to run on; an actor started while its parent is ending is stopped at once and its parent does not wait for it; astoppingblock is given to the context after the body’s statements, and severalonStoppingfunctions run in the order given;children()omits a child once it has ended, before its end is told to watchers. Why: each is the reading that never traps on a race and never leaves a parent waiting for ever. Alternatives weighed:stop(self)trapping as “not a child”; stopping an ended non-child trapping (needs a record of every child that ever ended); a child started fromstoppingmade a top-level actor instead. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-lifecycle): Watching, the cases the chapter leaves open. Watching an actor again replaces the earlier watch, so its end is told once; an actor watching itself is told nothing;watch(ref, f)takes a@sendablef, run on the pool where the end is known, its result queued;unwatchand the replacing watch drop a message already queued and not yet handled. Why: one message per watched end is what a program counting ends needs, and the dropped message is what makesunwatchmean something under a race. Alternatives weighed: a message perwatchcall; runningfin the watcher’s turn (the mailbox would hold functions rather than messages); watching itself trapping. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-lifecycle): Timers. One thread, started with the first timer, keeps every actor’s timers and sleeps until the earliest is due; timers fire in the order they fall due, those due together in the order they were set; a delay of zero or less is due at once; a repeating timer is set again an interval after it fires (it does not catch up after a stall), and an interval of zero or less traps;cancel()works from any thread, since aTimeris sendable, and drops a message of it queued and not yet handled.Timerhas onlycancel(). Why: a thread per timer would hold a worker per pending timer, and dropping queued messages makes a cancelled timer’s count exact without timing. Alternatives weighed: a fixed rate that catches up;every(zero)sending as fast as it is handled; anisActive()query (left out until a program needs it). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-lifecycle): An actor’s state is never captured by a@sendablefunction, whatever its fields:Future(stop())in an arm, or a body reading avalfield, is refused withit uses the state of the actor `Escaper`, which only the actor's own code reaches; copy what it needs into a `val` first. Before, only a state with avarwas refused. Why: the context’s methods act for the actor that is running, so a state carried to another thread is never right to use there, and the static refusal says so where the runtime would trap. Alternatives weighed: keeping the structural rule and relying on the trap. Review with the user: it tightens a settled rule. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-lifecycle): The expected type bounds a contravariant type argument of a call’s result only from below (generics). A call whose result isSink[T]for a contravariantTtakesTfrom its arguments, and from the expected type only where they leave it open, sowatch(spawn(Worker()), …)andval r: ActorRef[Nothing] = spawn(Quiet())check. Before, the expectedActorRef[Nothing]madeMNothingand the argument was refused. Why:Sink[A]is aSink[B]for everyBbelowA, so the expected argument says nothing aboutTbeyond a lower bound. Alternatives weighed: recording a lower bound on the variable (the checker’s unknowns hold one type, not bounds). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-ask):Endedmeans “not delivered”, decided at the send. An ask completes withErr(Ended)exactly where the asked actor was ending or had ended when the question was sent, so the message was dropped. A question that was queued and then dropped because the actor ended before handling it times out. Why: the chapter definesEndedas “the message could not be delivered”, and an actor may legitimately forward the reply reference and end, the reply still to come from another actor; watching the asked actor’s end for every ask would also hold a callback per ask on long-lived actors. Alternative: complete withEndedas soon as the asked actor ends before a reply (quicker failure for a question dropped from a mailbox, wrong for forwarded replies). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-ask): An ask’s reply reference is an ordinaryActorRef[R]shown asReply#n, numbered from one apart from the actors (so asks never disturb the actors’ numbering), unequal to every other reference; itsended()completes (Stopped) once the ask has its answer or has timed out, and an ask of a used reply reference answersEnded. Why: it is a one-shot address, so it ends when it can accept nothing more. Alternatives: no identity of its own (sharing the asker’s, whichmainand threads do not have), or numbering it among the actors. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-ask): The timeout is set once the question is delivered; a timeout of zero or less times out at once unless the reply was already there. Alternative: trap on a timeout not more than zero aseverydoes on its interval (a zero timeout is a legitimate “only if it is already answered”). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-ask):adapter(f)‘sfruns where the message is sent, so it is@sendable, and the adapter refers to the adapting actor: equal to itsself, the same hash and display, the sameended(); a message sent to it once the actor has ended is dropped, and an ask of it answersEnded. Why: the mailbox holds the actor’s own message type, so translating at the send keeps it so, and the chapter says a reference compares by the actor it refers to. Alternative: translate in the actor’s own turn, which would letfread the actor’s state but needs a mailbox of translations. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-ask):pipeToSelfof a future complete already sends at once, so its message precedes any the actor sends itself after the call, and two such pipes arrive in the order they were made; an incomplete one sends from wherever the future completes, sofis@sendable.Tcarries noSendablebound, the value never leaving the future’s own handing-over. Alternative: always go throughonComplete, leaving the order of an already-complete pipe and a latertellopen. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-ask): A lambda’s parameter of a known shape with an open type argument (Promise[T],ActorRef[R]) takes that shape, and the body decides the argument, asp -> ReadLine(p)decidesTfromReadLine‘s parameter; a body that leaves it open is reported at the parameter, once. A wholly unknown parameter type is still an error. Why: inference fails otherwise exactly where the explicit form succeeds, andask(r -> Get(r), …)is the chapter’s idiom. Alternative: require the type argument at every request-style call. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-failure): How a trap is contained. The runtime runs an actor’s start, messages andstoppingblocks under a return point (_setjmp), and a trap there restores the shadow stack, caller site and owner it recorded and returns to the turn (_longjmp). A count of regions in doubt on each thread (a lock held, which coversMutexandOnce; alazy valinitializing; an Avin function Sysl called) makes a trap inside one stop the program instead. Why: no unwinding tables are needed and the common path costs one_setjmpper turn. Alternatives: unwinding through every frame (needs landing pads in every function), or running each actor on a thread of its own (defeats many actors on few threads). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-failure):Failed‘s reason is the trap’s reason without its place (Failed(integer overflow)), the place being in the report. Alternative: the whole report line, which ties the value to the file layout. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-failure): Every trap in an actor’s code is reported naming the actor, also where it stops the program (a mutex held, aOnce, alazy val, a Sysl call), so the report says where the bug ran. Alternative: the plainavin: trap:line where the program stops, as a thread’s. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-failure): A stack overflow in an actor stops the program, as in a thread, withavin: trap: stack overflow: the stack may run out inside the runtime or the C library holding a lock, so nothing can be said about shared state. Alternative: contain it withsiglongjmpfrom the signal handler (unsafe where the fault came from inside a lock). Review with the user: the chapter lists no exception for it. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-failure): An actor that escalates handles nothing more and waits for its parent’s failure to stop it (it endsFailed), rather than ending at once; a failure escalated to a parent that is already ending or restarting is dropped, since the parent is stopping its children anyway. Why: a failure escalated to the top then stops the program with nostoppingblock run anywhere, deterministically, and the parent’s supervision decides the whole branch’s fate. Alternative: the child ends on its own and tells the parent, which races the program’s stop against the branch’sstoppingblocks. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-failure): A restart also cancels the actor’s watches (its timers are cancelled as the chapter says), since the fresh state sets its own; its reference, number, parent and watchers stay, and a stop asked for before the restart is honoured after it. A restart is reported asavin: restarting Counter#3, after the trap’s line. Alternative: keep the watches, whose messages the fresh state may not expect. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-failure):Restart‘s window counts restarts made within the lastwithin; a limit less than zero or a window not more than zero traps inspawn, as aneveryinterval not more than zero does. Alternative: treat them as zero (a zero window would silently mean “restart for ever”). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-failure): A trap in astoppingblock ends the actorFailedwith that reason, or keeps the first reason where a trap had failed it already, asks no supervision (so a block that traps during a restart ends the actor), and runs no lateronStoppingfunction. Alternative: end itStoppedwhere it was stopping (hides the bug from its watchers). -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-failure): ApipeToSelffunction and a watch’s function run in the receiving actor’s own turn, when it takes the message, rather than wherever the future or the end completed, so a trap in one fails the actor that asked for it and never an unrelated thread or the actor watched. The message of a pipe of a future complete already is still made at once, in the actor’s code. This revises the earlier pipe decision’s “sends from wherever the future completes”. An adapter’s function still runs at the send (its trap is the sender’s), as settled. Alternative: leave them where the value is known, where a trap stops the program from a pool worker or fails the watched actor in the middle of ending. Review with the user: the adapter and the pipe now differ in where their function runs. -
Settled on the user’s delegation 2026-11-05 (built on branch
actor-failure):spawn‘s parameters are(behaviour, onFailure, executor), as the chapter writes them, so an executor alone is given by name (executor = ex). Alternative: keep the executor second.
C bindings
-
Settled by the user 2026-11-05: public C interoperability is no longer deferred. The user’s words, on how to build the MLT library: “Doing it as a c binding would force c interoperability and would provide a good stressor for it. The sysl MLT binding isn’t being used.” So Avin binds C libraries itself (C bindings), and
avin-lang/mlt, MLT 7 bound over them, is the stressor that drives the work (roadmap stage 13). Until it is built, C is reached through Sysl as before. -
Settled 2026-11-05 on the user’s question “Why should C interop go through Sysl since avin generates LLVM IR?”: a C binding is a direct call (how a C binding is compiled). The emitter declares the C symbol in the LLVM IR and Avin’s own code calls it; clang links the library with the flags
pkg-configanswers. What the Sysl shim does for a Sysl binding — converting arguments and results, theenter_safe/leave_safebracket of ablockingcall, keeping a handle’s reference, callback trampolines and attaching a C-owned thread — is done by Avin’s lowering and the runtime. Why: the shim exists so that Sysl checks a binding against a Sysl signature, and a C binding has none, so a shim would add a compile step, a cache and a Sysl dependency and check nothing. Alternative weighed: lowering each C binding into the Sysl shim as anextern(the director’s first recommendation), which would have had Sysl’s ABI lowering of aggregates for free but no check against C’s header, since Sysl does not read headers. -
Settled on the user’s delegation 2026-11-05 (built on branch
c-interop-design): C bindings (chapter). Each is the recommendation the chapter is written to:- The binding copies the C prototype as a string,
@c("char *mlt_properties_get(mlt_properties self, const char *name)"), beside an Avin signature in Avin types, matched by position. Why: C’sunsigned,long,constand typedefs cannot be said in Avin types, the prototype is what a reader compares with the header, and clang can check it exactly. Three marker words (out,inout,userdata) andlength(p)say what C’s types do not. Alternatives: a vocabulary of C types in Avin (CInt,CSize, …), a second type system in safe code; C types implied by the Avin types, which cannot spell auint32_tor a typedef. - Every binding is checked against its header, by clang, in a generated C unit: a
_Static_assertof__builtin_types_compatible_pper binding, the kind of each typedef, every mirror’s layout; the unit also measures typedef widths, enumerators and constants as object-file data read without running it (cross builds measure the target). A package with bindings and noheadersis refused. Why: it is the one check on the trusted surface that can be automatic. Alternatives: trusting the declaration as a Syslexterndoes; parsing headers in the compiler (the Sysl project refused that too). - C libraries are named in the manifest,
c-libraries { mlt { pkg-config, headers, install } }(orlink = [...]), and every program links the C libraries of all its packages. Why: it is the shape ofsysl-dependencies, and a library’s requirement travels with it. Alternative: a module-header@link, as Sysl writes it, which cannot carry headers or the install message. - Struct by value goes through clang-compiled glue, which takes and answers the struct by
pointer; scalars, pointers and structs by pointer are called directly. Why: clang’s ABI
classification is right on every target at once, and the C unit already exists. Alternatives:
implementing AAPCS64 (Darwin first) and then System V x86-64 classification in lowering, a
per-target body of code whose bugs corrupt arguments silently; refusing by-value structs, which
MLT’s
mlt_colorandmlt_event_dataneed. Review with the user if the extra call is ever measured to matter. - Handles own one C reference: a pointer answered is owned unless the binding says
borrowed, which needs aretain;release/retainare a C function or a C expression inself;as:lists the other C types a handle passes as (C’s first-member inheritance), each by a C conversion that lends;keeps:makes the holder keep an Avin object (MLT’s profile),consumes:closes a handle the call takes. Why: the sysl MLT binding found exactly these shapes, and every one is written once per class or binding. Alternative: one Avin handle class per C type with explicit upcast bindings, many more declarations for the same check. - C handles keep the single-owner check;
sharedexempts a thread-safe C object and makes it sendable. Why: most C objects are not thread-safe. Alternative: no check for C handles. - Strings:
const char *from astringcopied with a NUL, a held NUL trapping; achar *result copied and UTF-8-checked (trapping),Array[byte]for unchecked bytes, borrowed unlessfree:names the freeing function. Alternatives: truncating at a NUL, replacing invalid UTF-8 with U+FFFD (what standard input does), aResultper string result. - Null is
Option; a null bound as the type itself traps. A C integer bound asResult[unit, int]isOkon zero. Alternative: aResultfor null pointers, which would need an error the C call never gave. - Out parameters join the result, as a tuple after the C result or in a status’s
Ok. Why: Avin has no pointers to pass. Alternative: filled one-element arrays, which work today but read badly. - Buffers are copied (
bytes:) or borrowed as anavin.c.ByteView(view:), a read-only, bounds-checked handle holding its owner, closed when its owner is next used. Why: MLT may replace a frame’s image on the next call, so validity is “until the owner changes”, and the owner check catches every use after that. Alternatives: views valid only inside a block (frame.withImage { … }), which forbids keeping one at all; copy only, which costs a copy per frame. Writable views are proposed below, from the Cairo survey. - Callbacks: one C-convention trampoline per function type, the closure found through the
userdata, the runtime’s Sysl-callback record andcallback_enterreused;keeps:holds a registered callback on its handle, whoseforget:unregisters each beforerelease; a keeping class withoutforgetis refused;@threadedas for Sysl, a C thread attached per call. Alternative: a registration object returned to the caller, which the user must keep alive. - Varargs are refused. A package needing one may carry C. Why: an argument’s type cannot be
checked against
..., and a format string from Avin is a hole. Alternatives: allowing calls whose extra arguments the prototype fixes. Whether an Avin package may carry C sources of its own, compiled into the C unit, is itself proposed: it is the trusted escape hatch for macros with arguments and odd shapes, and it widens the trusted surface beyond@c(. - No pointer type and no
unsafeblock in Avin; the@cdeclarations (and the glue they generate) are the whole trusted surface. Why: soundness in safe code, and one grep finds everything to review. Alternative: anunsaferegion with a raw pointer type, which would let a binding’s pleasant layer be written in Avin but makes every Avin file a possible hole. errnowas not read by a binding at first; anerrnoflag answeringResult[T, int]from a-1result was the likely form, and is what was built, withErrnobesides (settled 2026-11-15, branchc-opaque-errno).- Review with the user: the prototype-string form of
@c, the largest syntax choice here; whether a package may carry C sources, which widens the trusted surface beyond the@clines; the two parser additions (valwith no initializer for@c(const:), list-valued annotation arguments); and a missing@threadedon a callback C calls from its own thread being caught only by a trap at run time.
- The binding copies the C prototype as a string,
-
Settled on the user’s delegation 2026-11-05 (built on branch
c-bindings-scalars): C bindings of scalars (stage 13 step 1), the choices building it made where the chapter is silent.- A typedef’s kind is decided by the Avin type and checked by the C unit with
__builtin_classify_type: an integer type for an integer, an integer one byte wide (of either sign, as a Ccharis) forbyte,boolforbool, a floating-point type forreal, its width measured to choosefloatordouble. Why: the checker cannot see the header, and the Avin type says what the binding means. Alternatives: a kind written in the prototype; measuring every typedef’s kind and refusing in the driver, which needs an expression valid for any type and C has none. unsigned charcrosses asbyteor as an integer type,char(and achartypedef) only asbyte,signed charonly as an integer type. Why: the table listsunsigned charin both rows andcharonly as a byte. Alternative:charas an integer at its measured sign, which makes a program’s meaning depend on the machine.- An argument’s trap names the C type,
value out of range for u64 (size_t); a result’s names the Avin type,value out of range for long, as a Sysl binding’s do. Alternative: naming both types in both directions. - A result the binding declares
unitis declaredvoidin the IR, so a discarded pointer or integer needs no measurement; a struct result is refused even then, since it may be returned through memory. Alternative: declaring the measured type and ignoring the value. - The measurements are found by a marker in the object’s bytes, one table of two bytes per type (width, sign), rather than by its symbol, so no object format (Mach-O, ELF, COFF) is parsed. Alternative: reading the symbol table, a reader per format.
- The mismatch diagnostic takes its two types from a pointer of the prototype’s type set to
the header’s function, whose clang diagnostic keeps the typedefs’ names, and the header from
the note of a redeclaration as the prototype says it; the
_Static_assertstays the check, so a clang that only warns on the pointer still refuses the binding. Alternative: the assertion’s own text, which clang writes with every typedef expanded. - The toolchain names the
pkg-configit asks (Toolchain.pkg_config), so a build for another machine can ask that machine’s, and the corpus asks one that also finds the C fixture intests/c, which it builds. Alternatives: the environment’sPKG_CONFIG_PATH, which a test cannot set for the compiler it runs in its own process; a package-relative.pcpath in the manifest, which the chapter does not have. Review with the user: whetheravinshould readPKG_CONFIGas autotools does. - A function a header declares
static inlineis not caught by the header check: C lets the unit’s redeclaration inherit the internal linkage, so the binding fails at the link, where the linker names the missing symbol. Alternative: reading the C unit’s symbol table for a local definition, a reader per object format.
- A typedef’s kind is decided by the Avin type and checked by the C unit with
-
Settled on the user’s delegation 2026-11-05 (built on branch
cairo-survey): C bindings, from the Cairo survey (chapter). The user asked foravin-lang/cairo, Cairo 1.18 bound over the C bindings besideavin-lang/mlt, ported from the reference binding’s surface. Mapping it onto the chapter found these lacks; each is the smallest addition that covers it:- An integer bound as
boolisfalsefor zero,trueotherwise; aboolpasses0/1. Why:cairo_bool_tis anint, and so is every pre-C99 library’s truth value. Alternatives: binding it asintand comparing in Avin at every call site; atruthmarker word in the prototype, which says what the Avin type already does. - A status that is a C enum binds as
Result[unit, E]withEits mirror:Okfor the zero enumerator,Err(variant)otherwise; the mirror keeps its zero variant, which a callback answers. Why: Cairo’scairo_status_tis the error type itself, and mapping anintback to it by hand repeats the enum. Alternatives:Result[unit, int]and a mapping function; requiring the mirror to omit its zero variant, which a callback answeringSuccesscould not then name. - Latched errors need nothing new: the status query is an ordinary binding, and the library
asks it after constructors, before output (
writePng,finish, the PNG stream) and on request, answeringResult[_, CairoError]there andunitfrom the drawing calls. Why: Cairo latches errors on the object and makes every later call a no-op, so the next query sees every failure. Alternatives: a per-classstatus:expression the compiler checks after every call, trapping or answeringResultfrom all ~150 drawing calls, which costs a call each and makes every line of drawing code carry a?; trapping on any latched error, which turns a bad PNG file into a crash. Review with the user: whether drawing calls should trap on a latched error in a debug build. attach:ties what a handle keeps to the C object’s lifetime, through the library’s destroy notification (cairo_surface_set_user_data,mlt_properties_set_data): the kept objects move to a pinned runtime record that C’sdestroyreleases;key:names the static key type the C unit defines per class. Why: Cairo contexts and surface patterns reference their surface, so the AvinSurfacecan be collected while C still draws into theByteBlock(or font file) it was made over — a use after free thatkeeps:on the handle does not prevent. The same gap reaches MLT wherever a C object that keeps a pointer (a producer keeping its profile) is held by another C object (a playlist) after its Avin handle is collected. Alternatives: keeping the kept objects for the rest of the program, a leak per surface; refusingkeeps:on handles C can reference, which refusescreate_for_data; making the library hold every surface in an Avin table. Review with the user: whether the MLTkeeps:bindings should move toattach:too.- Field accessors take expressions and bounded indices:
field:a C lvalue inselfand the accessor’s parameters,bound:the C expression an index is checked below; an index with no bound is refused. Why:cairo_path_tis a C-owned array of a union, which no mirror may hold, and reading it element by element through glue keeps the union out of Avin. Alternatives: an opaque value per element, which needs by-value glue for every read; a package-carried C file flattening the path into doubles, the trusted escape hatch proposed above, wider than one line. Optionof a mirror for a nullableconst T *. Why:cairo_recording_surface_createtakes null for unbounded extents. Alternative: two bindings, one passing a sentinel struct.- Upper-case enumerators match an upper-case prefix (
CAIRO_FORMAT_→Argb32). Why: most C libraries write enumerators in upper case. Alternative:@c("name")on every variant. - String and
realconstants:@c(const:)reads a string literal’s bytes as a measurement, checked as UTF-8. Why: Cairo’s tag names (CAIRO_TAG_DEST) are string macros. Alternative: copying the literals into Avin, which drifts if the header changes them. - Arrays of mirrors go to
const T *converted into C memory for the call; arrays C allocates are copied out witharray:,length:andfree:(generalizingbytes:). Why: Cairo’s glyph arrays, in (cairo_show_glyphs) and out (cairo_scaled_font_text_to_glyphs). Alternatives: a handle oncairo_glyph_allocate‘s array with indexed writers, a C-shaped API in Avin code; writing a converted array back for non-constpointers, which no Cairo call needs. viewon the result, and writable views: a bareviewnames the C result as the memory;writableanswers anavin.c.MutByteView(aByteViewwithupdate,fill,write), closed by the owner’s next use like any view. Why: Cairo’s pixel access iscairo_image_surface_get_data‘s result, and the reference program writes pixels and callsmark_dirty, which, being a use, closes the view so a write after it traps. Alternatives: copy out, edit, copy back withcreate_for_data(a full copy per edit); a block-scopedwithPixels { … }, which the chapter already weighed against for reading; oneByteViewtype with a run-time writable flag, which moves a type error to run time. Astablemarker for owner methods that do not close views (Cairo’sget_widthafterget_data) was weighed and left out: the library reads those first.avin.c.ByteBlock, memory Avin gives C: fixed-length, zeroed, outside the collected heap, never copied at a call, read and written like aMutByteView, freed when collected, kept by C throughkeeps:(andattach:). Why:cairo_image_surface_create_for_datakeeps the pointer and writes into it for the surface’s life, which neither a copied array nor a heap array (moved out of the heap forblockingcalls) can be. Alternatives: pinning anArray[byte]in the collector, which pins the collector’s design to non-moving arrays; leavingcreate_for_dataunbound (the reference program uses it).- Memory lent to a callback is a view closed when it returns,
constaByteView, otherwise aMutByteView, its length from alength(p)beside it; a function-pointer typedef is written out in the prototype. Why: Cairo’s PNG write and read streams pass(closure, data, length). Alternatives: a copiedArray[byte]per chunk (fine for writing, impossible for reading, where the callback must fill C’s buffer). - Steps 8 and 9 of stage 13 swap: buffers before callbacks, so callbacks can take views. Why: the PNG stream needs both, and neither MLT step needs the other. Alternative: callbacks first with copied arrays, the read stream deferred.
- The survey’s three questions, settled with it.
attach:for MLT: only where C keeps something Avin owns that C’s own reference count does not cover (memory Avin gives C, a callback’s closure); MLT’s playlists, tractors and services take their own reference to what they are given, so a counted handle needs nothing more, and the MLT steps are audited for the other cases. Review with the user. No trap on a latched error in debug builds: a program behaves the same at every optimization level; the binding checks the status after constructors and before output, as the chapter says. A FreeType binding (avin-lang/freetype) waits until Cairo’s font-face step needs it; the toy font API and the platform’s own font backend come first.
- An integer bound as
-
Settled on the user’s delegation 2026-11-05 (built on branch
freetype-design): C bindings, from the FreeType survey (chapter). The user: “Yes we’ll need a freetype binding to work with cairo.” The user (2026-11-05): “Yes we’ll need a freetype binding to work with cairo.” A third stressor,avin-lang/freetype, binds FreeType 2 (pkg-config freetype2) to the reference binding’s surface, andavin-lang/cairodepends on it for Cairo’s FreeType font faces (cairo-ft.h). This replaces the Cairo survey’s “a FreeType binding waits until Cairo’s font-face step needs it”. Mapping the reference surface onto the chapter found these lacks; each is the smallest addition that covers it:- A binding may name a handle class of another package its package depends on: the prototype
names the class’s own C type or an
as:type; the class’s glue is the declaring package’s, compiled once; the package’s bindings are checked after theheaders, and with thepkg-configflags, of every package whose handle classes they name, in dependency order; ownership (lent,keeps:,consumes:,attach:, owned andborrowedresults) crosses unchanged. Why:cairo_ft_font_face_create_for_ft_facetakes FreeType’sFT_Face, and a header of one library need not include the other’s (Cairo’s happens to; most do not). Alternatives: a third package holding only the shared handle class, which the reference binding needs only to break a dependency cycle Avin does not have; Cairo declaring its ownFT_Facehandle, two handles with two owners and tworeleases on one C object, a double free; trusting each library’s header to include the other’s. - A header may be named by a macro: an entry of
headersthat is a C identifier is emitted as#include NAME, defined by an earlier entry, and a macro no earlier header defines is reported at the entry. Why: FreeType documents its headers by macro (#include <ft2build.h>then#include FT_FREETYPE_H), and Cairo’s owncairo-ft.hincludes it so. Alternatives: naming the path the macro expands to (<freetype/freetype.h>), which the installed FreeType’s ownft2build.hshows and which needs nothing new, but writes into the manifest a layout that FreeType’s macros exist to keep its users out of; apreludestring of raw C lines in the manifest, wider than one rule and the start of a C file in HOCON. - A kept handle whose class declares
retainis held by a C reference, taken through thatretainwhen the call succeeds and given back through itsreleaseafter the holder’s ownrelease. Why: the collector finalizes the unreachable in address order, so aFaceand theLibraryit keeps, dead in one collection, may be finalized library first; freeing the library frees every face still in it, and the face’sFT_Done_Facethen frees one twice. With the reference, the library’srelease,FT_Done_Library, only drops a count (FT_Done_FreeTypealso frees the memory manager whatever the count, so it is norelease). MLT’sConsumerkeeping itsPlaylist(keeps: "source") gains the same order. Alternatives: ordered finalization in the collector (kept before keeper), which Avin cannot change and which the collector’s address-order sweep does not offer; holding the Avin object and taking the order on trust, a use after free whenever areleasetouches what it keeps; making the library’sreleasea no-op while faces exist, a count in Avin of what C already counts. kept: "name: Class"lets a holder’srelease:/retain:name what it keeps, as that handle’s C pointer; the class is made only by bindings keeping exactly one handle of that class, and an unused name is refused. Why:FT_Done_MM_Var(library, master)frees the variation descriptor through a library the descriptor does not record; the face it came from publishes it (face->glyph->library), and the C reference above keeps that face valid until after therelease. Alternatives: walking the descriptor into Avin data and freeing it inside one binding, which needs a binding that copies a C struct holding arrays of structs (a larger addition); areleasetaking a second argument from a per-handle C field the runtime stores, the same thing with a less readable spelling; leaving the variation API unbound.keeps:takes a list (keeps: ["library", "base"]). Why:FT_New_Memory_Facekeeps its library and its memory. Alternative: repeating the key, which HOCON merges rather than lists.keeps:naming an array parameter is refused, since its C copy lives for the call; memory C keeps is aByteBlock. Why:FT_New_Memory_Facereads its buffer lazily for the face’s life. Alternative: pinning the array, which theByteBlockdecision already weighed against.length(p)may mark aninoutpointer to an integer: the array’s length is written in, C’s answer is part of the result, checked to be no more than the length;Nonefor anOptionof the array passes null and zero. Why:FT_Load_Sfnt_TabletakesFT_ULong *length, and is called once with no buffer to learn a table’s size, then again to fill one. Alternatives: aninoutlength the caller passes, which lets the length and the array disagree (a read past the end); aByteBlocksized by a first call, the same disagreement.- A field accessor may answer a
viewof a byte-pointer field,length:a C expression inself. Why: the glyph bitmap isface->glyph->bitmap.buffer,|pitch| * rowsbytes the next load replaces; the view’s closing on the face’s next use is exactly FreeType’s rule. Alternatives:bytes:on a field, a copy of every glyph before the library walks it, which the library could still choose; a glue function per field answering the pointer, the same with more C. The view’s bounds check catches the reference binding’srow * pitchindexing, which reads before the buffer whenpitchis negative. - Cairo’s FreeType font face is an
attach:class keeping theFace. Cairo keeps theFT_Facewithout a reference, documents that it must outlive every font face made from it, and asks for it to be given back fromcairo_font_face_set_user_data‘s destructor; contexts and scaled fonts reference the font face, sokeeps:on the Avin handle is not enough. The destroy unpins the record and theFaceis then finalized as usual. Alternative: a destroy that callsFT_Done_Faceitself, from whatever thread drops the last reference, while an AvinFacemay still be in use: FreeType’s face count is not atomic. FT_Error_Stringbinds asOption[string], and the library carries its own names for the codes, as@c(const:)values offterrors.h‘sFT_Err_*. Why: Homebrew’s FreeType is built withoutFT_CONFIG_OPTION_ERROR_STRINGS, so the function answers null there.- The test font is Kaisei Decol Regular, from the reference repository, under the SIL Open
Font License 1.1 (Copyright 2020 The Kaisei Project Authors, no Reserved Font Name), bundled
with its
OFL.txtin the package’s tests. Alternative: a smaller OFL Latin font (4.4 MB is large for a test fixture), at the cost of a font the reference program’s output was not made with. Review with the user: the fixture’s size. - Left out:
cairo_ft_font_options_substitute, which takes a fontconfigFcPattern *and waits on a fontconfig binding;FT_Outline_Decomposeand the other callback APIs, which the reference binding does not reach. - The survey’s two questions, settled with it. The test font is a small OFL font, not Kaisei
Decol Regular (OFL 1.1 and usable, but 4.4 MB): a Latin face of a few hundred kilobytes, its
licence file beside it in the package’s tests, keeps the repository light, and the reference
binding’s outputs that need Kaisei’s glyphs are reproduced with the small face’s instead.
cairo_ft_font_options_substitutewaits on a fontconfig binding: it takes a fontconfig pattern, and nothing else incairoorfreetypeneeds fontconfig. The macro-named headers andFT_Error_String, which the survey placed in step 2, ride step 3, since step 2 was already being built.
- A binding may name a handle class of another package its package depends on: the prototype
names the class’s own C type or an
-
Settled on the user’s delegation 2026-11-05 (built on branch
c-bindings-strings): C bindings of strings and truth values (stage 13 step 2), the choices building it made where the chapter is silent.- A C string is exactly one pointer to a plain
char,constwhen the qualifier comes before the star (const char *,char const *); a qualifier after it (char *const) is the pointer’s own and changes nothing.signed char *,unsigned char *,void *andchar **are other pointers. Why: those are the types C’s string functions use, and the header check catches any other spelling. Alternative: takingunsigned char *as a string too, which libraries use for bytes, not text. - A typedef crossing as a string is checked by the C unit to be
char *orconst char *as a result, andconst char *as a parameter (__builtin_types_compatible_p), and is not measured. Why: the same rule the chapter gives a spelledchar *parameter, which C may write. - A typedef crossing as
boolmay be a Cboolor an integer type (checked with__builtin_classify_type), and is passed as the integer it measures; a Cbooltypedef is then one byte holding 0 or 1, the same registers as ani1. An integer keyword crossing asboolmay be any but a plainchar, which crosses only asbyte. Why: the checker cannot tell abooltypedef fromcairo_bool_t, and one measured path serves both. Alternative: a marker word for a truth value, which the Cairo survey weighed and set aside. - The traps’ words:
the string passed to `s` of `length` holds a NUL at byte 3(the chapter’s),`fixture_invalid` answered a string that is not UTF-8 at byte 2(the offset is where the first ill-formed sequence starts, asfrom_utf8reports it; overlong forms, surrogates, values past U+10FFFF and a cut-off sequence are all ill-formed), and`fixture_maybe` answered null(the chapter’s). A parameter declared with a pattern rather than a name is namedparameter N. Alternative: naming the binding rather than the C function in the result traps; the C function is what answered. - A string argument’s copy is freed after the result is converted, not when the call
returns, since C may answer a pointer into a string it was passed (
strchr,strstr); the copies are made withmallocby the runtime (avin_rt_c_string_in) and freed byavin_rt_c_string_free. A non-blockingcall cannot collect, and the collector never moves an object, but the copy is still needed for the NUL. Alternative: one buffer per thread reused across calls, which a callback calling the same binding again would overwrite. free:accepts a function the headers declare asvoid (void *),void (char *),void (const char *)orvoid (<the result's type>); anything else, including one answering a value, is refused at the binding, as is a name no header declares. It is called only for a non-null answer, after the copy is made, and a binding whose result isunitwithfree:frees what C answered and discards it.free:on a binding that answers no string is refused at check. Why: a free function that answers a status is not one a binding can ignore, and a library’s own free functions are seldom safe on null. Alternative: refusingfree:on aunitresult, which would leave no way to call such a function without leaking.- An
Array[byte]result may be anOptiontoo, null beingNone, and a null bound as a bareArray[byte]traps as a barestringdoes. AnArray[byte]parameter is refused until arrays are built. Alternative: an empty array for null, which hides the difference C makes.
Review with the user: whether
free:on aunitresult should stay legal. - A C string is exactly one pointer to a plain
-
Settled on the user’s delegation 2026-11-05 (built on branch
c-bindings-handles): C handles (stage 13 step 3), the choices building them made where the chapter is silent.sharedis a bare word of the class’s@c,@c(type: …, release: …, shared). Why: the@c(lines are the whole trusted surface, and a thread-safety claim is one of them; no class modifier says it today. Alternative: ashared classmodifier, a keyword for one use.- A handle’s method is bound by a prototype taking the receiver first, named
self, of the class’s C type (or that typeconst); the method’s parameters follow by position. Why: the chapter’s every example writes it so, and the name makes the receiver visible in the C text. Alternative: the receiver at any position namedself, which no surveyed library needs. - What keeps is the handle the binding answers, else a method’s receiver, and a method
answering a handle may name
selfinkeeps:to have the new handle keep the receiver. Nothing is kept unless the call succeeded: a handle answered (not null), or a zero status. Why: a library object made by a method of another usually depends on it (a face’s variation descriptor). Alternative: the receiver always keeps for a method, which leaves the made handle unprotected. consumes:closes the handle passed whatever the call answers, and may nameself; the consumed handle keeps what it kept until it is collected or closed. Why: C functions that take a reference take it unconditionally, and giving back what the consumed object keeps while C still holds the object would be a use after free. Alternatives: closing only on success, which most taking functions do not distinguish; releasing what it keeps at once.- A holder keeping a handle by a C reference also takes one to each C object that handle so
holds, after it, given back after it. Why: found under the collector’s stress in the
fixture: a variation descriptor keeps a face, the face’s own handle is collected first and gives
back its reference to the library, and the library is freed under a face the descriptor’s
releasereaches through. Alternatives: holding the kept handle as the Avin object as well, which orders nothing within one collection; refusing chains of kept handles, which FreeType’s API is. - The class
kept:names declaresretainand nokept:of its own, and is found in the holder’s module or by its module and name (freetype.Face);retain:sees the name only where it takes aborrowedresult’s reference, as the pointer of the handle the binding keeps; a holder keeping a handle whose class haskept:holds it as the Avin object. Why: the name is a pointer only while a C reference holds it, and a class withkept:cannot be given back from its pointer alone. Alternative: storing every kept name in the C reference’s record, which then has to hold references of its own, the same chain again. - A status’s code is any integer type, converted with the result’s range check
(
Result[unit, long]forlong long; along longcode pastinttraps forResult[unit, int]). Alternative:intonly, which loses alongstatus’s code. - The C unit includes a package’s headers after those of every package whose handle classes its bindings name, and otherwise in the order the libraries are listed, the program’s own first. Why: that is the only order the header check depends on, and it is read from the bindings themselves. Alternative: a topological order of the whole package graph, which reorders headers no binding needs reordered.
Review with the user:
sharedas a word of@crather than a modifier, and the chain of C references a kept handle brings with it. -
Settled on the user’s delegation 2026-11-05 (built on branch
c-bindings-fields):as:conversions and field accessors (stage 13 step 4), the choices building them made where the chapter is silent.- An
as:entry’s right side is a C function’s name or an expression inself, asrelease:‘s is, andas:is one string or a list. The C unit checks with__builtin_types_compatible_pthat what it makes is the entry’s type. Why: one rule for every piece of glue, and C would otherwise convert a wrong pointer silently (the C unit compiles with warnings off). Alternative: an expression only, which makes MLT’s every entry repeat(self). - A conversion is made after the closed and owner checks, from the handle’s own pointer, and
passes null as null; what a binding
keeps:orconsumes:is the handle itself, held by its class’s ownretain, never the converted pointer. Why: the converted pointer is lent and may point into the object, so a reference taken through another class’s glue would be the wrong count. Alternative: holding the converted pointer, which has noreleaseof its own. - A field is a member path read as
self->followed by it; its type is named in the C unit by__typeof__with the indices replaced by zero, so it is measured and checked without being read. Why: every surveyed accessor (MLT’s profile, FreeType’s face and glyph slot, Cairo’s path) is a member path, and an unevaluated operand needs no index. Alternative: a full C expression inself, which nothing surveyed needs and which makesself->noise in each. - Only scalars are written; a string or handle field is read only. Why: a string or a
reference stored into a C struct needs an owner that frees or gives it back, which no surveyed
library asks Avin to be. Alternative: writing strings copied with
mallocand never freed. - Indices are
intorlong, passed aslong long, onebound:each, in order, a list for more than one; a bound may useselfand the indices. The check is0 <= index < bound, made in Avin before the glue reads, trapping with “indexiofClass.methodout of range”. Why: a two-dimensional field needs a bound per index, and the trap names the index that was out of range. Alternative: one bound for all indices. - A handle read from a field is lent, without
borrowedwritten, and its class must declareretainand nokept:. Why: a struct’s pointer is never the reader’s to give back. Alternative: requiringborrowed, a word that could only ever be written one way.
Review with the user: writers of scalars only.
- An
-
Settled on the user’s delegation 2026-11-05: Dates and times (branch
datetime-design), the choices the design makes beyond the user’s settled entry. Where the slate design leaves a name open, the names follow the widely used date/time library family of Avin’s reference standard library ecosystem (atZone,plusDays,withYear,toInstant,isBefore,toMinutes), except where a slate or a simpler spelling is better, as each entry says. -
Representation and ranges. Every type but
Zoneis adatatype whose fields are its representation (Duration(micros),Instant(epochMicros),Date(epochDay: int),Time(microsOfDay),DateTime(date, time),Zoned(dateTime, offset, zone),Period(months, days)); the makers check and the constructors take fields as given. ADurationand anInstantspan a wholelong, aDatea wholeintof days, and what leaves a range traps. Why: data types are unboxed values, and every field value ofDuration,Instant,DateandPeriodis meaningful, so those constructors are total. Alternatives: one common range for every type (±290,000 years), cleaner to state, but enforceable only with constructors the module keeps to itself, which Avin does not have; classes with private state, boxed and with identity. ATimeorZonedbuilt through its constructor with fields no maker would give is the cost. Review with the user: a module-private constructor would close it. -
Days and weeks are exact durations; a calendar day is
plusDays(n)orPeriod(0, n). The settled list makesdaysandweeksdurations, as Sysl 0.10.0’s are, soPeriodholds months and days (Sysl’sPeriod(months, days)),monthsandyearsmake it, andDate + Durationdoes not compile (date.plusDays(1)). On aZoned,z + days(1)is 24 hours andz.plusDays(1)the same wall clock a day later. Why: the user’s list and Sysl agree, and the exact/calendar line stays in the types. Alternatives: slate’s implementation, wheredaysandweeksmake periods sozoned + days(1)keeps the wall clock, which contradicts the settled list. Review with the user: the two spellings answer differently across a daylight-saving change. -
Names where slate leaves them open, and where slate’s are kept.
t.atZone(z),d.atTime(t),t.atDate(d),d.atStartOfDay(),zt.toInstant,plusYears/plusMonths/plusWeeks/plusDays(nominusforms: a negative count),withYear/withMonth/withDay/withHour…,isBefore/isAfter/isSameInstant, a duration’stoHours()(whole) andtoHoursPart(), a date’sdaysUntil/monthsUntil/until. Kept from slate as better:weekday()(shorter, and the name of its type) overdayOfWeek,day()and sowithDayoverdayOfMonth,onOrAfter(w)andonOrBefore(w)over adjuster objects,parseTimestamp, theepoch*makers. Slate’s singleatis speltatZone/atTime/atDate, since one overloaded word hides which conversion is meant andatZonenames what can fail.startOf("month")becomesstartOfMonth()and its siblings, so a date’sstartOfHouris a compile error rather than a run-time one. Alternatives: slate’sd.minutesfor whole minutes (the same word makes and measures),dayOfMonth. -
Choosing an instant for a skipped or repeated reading.
dt.atZone(z)answersResult[Zoned, ZoneTimeError](Skipped,Repeated), andatZoneEarlier(z)/atZoneLater(z), Sysl’sat_earlier/at_later, always answer: the earlier or later instant of a repeated hour, and in a skipped hour both push the reading past the gap by its length. A period on aZoned, awith…andstartOfDaypush past a gap and, in a repeated hour, keep the offset the reading had where it is one of the two and otherwise take the earlier. Why: what the binding gives, and the established rule. Alternatives: slate’s string choice ("earlier" | "later" | "after"), aPickenum argument. -
A
Zoned‘s equality and order.==needs the same instant in the same zone;Ordorders by instant, then wall reading, then zone name, so it agrees with==and aTreeMapkeeps two readings of one instant;isBefore,isAfterandisSameInstantcompare instants alone. Alternatives: slate’s, where<compares only the instant and so is false both ways for two zones’ readings of one instant, anOrdthat disagrees with==. Review with the user:<between two zones’ readings of one instant is decided by the zone names. -
Text. ISO 8601 with
T, the seconds always written, the fraction only when there is one and without trailing zeros (slate’s), years outside0–9999signed; a fixed zone’sZonedwrites no bracketed name. A duration keeps the form the user settled on 2026-11-04, its largest unit ofs,msandus(90.5s,1.5ms); a period writes as1y 2mo 3d. Why: one shape per column; the duration form is the user’s own decision, which a delegated choice does not overturn. Alternatives: Sysl’s renderers (a space forT, seconds dropped when zero), today’sWallTimeform with six fraction digits always, slate’s1h 30mduration form (the design agent’s proposal). Review with the user: whether durations should move to slate’s1h 30mform. -
Parsing.
parseDate,parseTime,parseDateTime,parseTimestampandparseZoned, each aResultwithTimeParseError(BadShape(text, at),OutOfRange(text, field),Trailing(text, at),UnknownZone(text, name),ata byte offset), every display read back, ASCII digits only, a timestamp’s offset required. Why: Sysl’s error kinds, with the text a message must quote. Alternatives: a message string only (slate); reading by pattern, left out until wanted. -
Patterns.
format(pattern)with slate’s pattern language (YYYY,MMMM,WWWW,h12,a,f…,z…,|literal|,||a bar), English names and no locales; an element the value lacks, a malformed run and an unclosed bar trap, the pattern being program text.Instanthas noformat. Alternatives: a compiled pattern answering aResult, asRegex.compiledoes, for patterns read from outside. -
Zones.
zone(name)answersResult[Zone, ZoneError](UnknownZone,NotAZoneNamedecided before any file is read,Malformed);localZone()always answers,utcwhere the host names no zone it can read;fixedZone(offset: Duration)takes whole minutes within ±23:59 and traps otherwise. An offset is aDurationand Sysl’sOffsetstays behind the binding.isDaylightSavingAtandabbreviationAtread the zone’s table throughsysl.time.tzif. Alternatives: anOffsettype of its own (a ninth public type),localZone()as aResult. -
The wall clock reads microseconds as the host gives them. Alternatives: whole milliseconds, slate’s choice for agreement with a back end Avin does not have.
-
Smaller additions:
isoWeek()andisoWeekYear();endOfMonth();Date - DateaPeriodof days;d / ebetween durations along; aPeriodand aZoneEqandHashbut notOrd; aTimewith no arithmetic;Weekdayordered Monday to Sunday withisoNumber()andplus(n);monthsandyearsas methods onintas the durations are onintandlong;3 * ddoes not compile, the built-in types’ operators gaining no methods. -
Delays. Every delay in the library is a
Duration:Future.awaitandCondition.waitForgain overloads taking one beside their milliseconds; a command’s deadline is amonotonic()reading; actor timers keep the runtime’s monotonic microseconds and theirDurationparameters. Alternatives: leaving the millisecond forms alone. -
Settled on the user’s delegation 2026-11-05: Data types of one module may share a variant’s name (branch
shared-variants). Replaces the rule that a variant’s name is unique across a module’s files, which kept a C or Sysl binding from mirroring two enums with one variant name (Slant.Normal,Weight.Normal;sysl.process‘sStdio.InheritandGroup.Inherit) and two machines from sharingIdle. Review with the user. The parts:- The expected type decides a bare use. A shared name is the variant of the type expected
where it is written: a parameter’s, an annotated binding’s, a result’s, a field’s, a
collection’s element, and in a pattern the matched value’s, so nested patterns decide each name
by its field’s type. Why: it is how the qualified form’s work is already done everywhere a type
is known, and it keeps bare names, Avin’s usual form, working in all the places a shared name is
actually used. Alternatives: refusing every bare use of a shared name (mirrors would read
Weight.Normaleverywhere); picking the first declared type (silent, order-dependent); deciding also by shape, a call meaning the variant with fields (a second rule for a reader to know; not built). - Where nothing decides it, an error names the types and the qualified forms: “
Normalis a variant ofSlantandWeight, and nothing here expects one of those types: writeSlant.NormalorWeight.Normal“. An expected type that is none of them is not a decision, andAnyor a trait expected is not either. Reached through a module, the forms keep the module:fonts.Slant.Normal. Why: the qualified form always works, so the fix is the message. - A comparison’s other operand decides, as it does a number literal’s type:
w == Normal,Normal != w. A shared name, bare or called, is checked after the other operands, with their type expected. Why: comparing with a variant is the commonest use outside amatch. Alternative: requiringis NormalorWeight.Normalthere. - Coverage, derived impls and shapes are per type and unchanged: a
matchoverWeightis covered byWeight‘s own variants;Display/Debugwrite the name;Eq/Hash/Ord,walkandbuilduse the type’s own declaration order; layouts and mirrors are keyed by type, and a mirrored variant crosses into Sysl as its own enum’s. - A shared name is still one name of the module: a function, module-level value or object of
that name is refused (“
Normalis already a variant ofSlantandWeight“), a companion object may not have a name another type’s variant has, and the name is not a type. Within one type a variant’s name stays its own. Why: functions and values are not chosen by expected type, so the clash would stay unresolvable. Alternative: letting a function or value hide the variants. - Imports:
import m.Normalis allowed wherem‘s types shareNormal; the imported name is shared in the importing file as inm, and decided the same way. Why: it costs no new rule and a file importing one of the names for its own type’s use reads naturally. Alternative weighed: refusing the import and asking for the type (import m.Weight, thenWeight.Normal), which the brief leaned to; refused because the bare form then could not be written at all in that file. - Visibility: a shared name is seen from another module where any of its types is public, and
a private type’s variant is left out there, so where only one type is public its variant needs
no deciding (
signals.Stop). Where all are private the name is private to its module. - Machines: two machines’ states, and a state and an event’s variant, may share a name, by the same
rule (amending the settled machine entry above). An arm’s result is its own
State,handle‘s argument the event type, so machine code needs nothing written.
- The expected type decides a bare use. A shared name is the variant of the type expected
where it is written: a parameter’s, an annotated binding’s, a result’s, a field’s, a
collection’s element, and in a pattern the matched value’s, so nested patterns decide each name
by its field’s type. Why: it is how the qualified form’s work is already done everywhere a type
is known, and it keeps bare names, Avin’s usual form, working in all the places a shared name is
actually used. Alternatives: refusing every bare use of a shared name (mirrors would read
-
Settled on the user’s delegation 2026-11-05 (built on branch
actor-state):stateblocks in actors (stage 12 step 8), the choices building it made where the chapter is silent.- Only a transition runs
leave: an actor that stops, fails or restarts runs itsstoppingblock, which readsstate(), and not the current state’sleave. Why: the chapter definesleaveas running when the actor moves out of a state into another, andstoppingis already the one block an ending runs; running both would run two cleanups for one ending, in an order the program cannot see. Alternative: running the current state’sleavebeforestopping, which suits a state holding a resource (the chapter’sReady(socket)) but runs code written for a transition when none happens. - A trap in
enterorleavefails the actor as a trap in an arm does, and a trap in aleaveleaves the actor in the state it was leaving; one in anenterleaves it in the state entered. The first state’senterruns as the last statement of the body, so a restart runs it again, and a trap there fails the actor as it starts. Why: the transition’s steps run in the order the chapter gives, inside the turn, and supervision already decides what a trap in a turn means. Alternative: rolling the state back on a trap, which needs a copy of the state before every transition. - An actor’s
Statetype and its states are private to its module, as the class holding its state is, andstate()is one of the actor’s own methods, not its reference’s. The states are still names of the module, and share a name with another type’s variant there, a machine’s states included, by the rule for shared variant names above. Why: nothing outside an actor reaches its state. Alternative: a publicStatetype another module could match on, which nothing could hand it. - An actor with states needs no
receiveblock, as a machine needs none; without states it still needs one. A shared arm of an actor with states yields a state, as a machine’s does. - No reentrancy trap: only the runtime hands an actor a message, one turn at a time, so the
actor needs no busy flag of the kind a machine’s
handlekeeps. - A sendable function reading a stateful actor’s fields is refused with the advice to copy into
a
val, not to make a field aval, which cannot make an actor that moves between states sendable.
Review with the user: the first choice; whether an ending should run the current state’s
leaveis the one a program holding a resource in a state notices. - Only a transition runs
-
Settled on the user’s delegation 2026-11-05: A variant pattern writes no type arguments (branch
qualified-variant-targs). In an expression a generic type’s variant takes its type arguments on the type,Heap[int].Leaf, or on the variant,Heap.Leaf[int]andHeap.Node[int](…)(settled by the declarations chapter’sOption.Some[long](9); only the fieldless form had been missing, and is now built). In a pattern neither form is written:case Heap.Leaf[int],case Heap[int].Node(…)andcase Some[int](x)are reported, “a pattern takes its type arguments from the value it matches; writeHeap.Leaf“. Why: the scrutinee’s type already decides them, so a written list could only repeat it or be an error, and a test of the instance is a type pattern’s job (x: Box[int]). Alternatives weighed: accepting both spellings in patterns with the arguments required to equal the scrutinee’s (more symmetric with expressions, but adds a rule that only restates the type); accepting them and ignoring them (silently wrong where they differ). Revisit if a pattern on anAnyscrutinee should match a variant at one instance, which would give written arguments a meaning. -
Settled on the user’s delegation 2026-11-05: C enum mirrors, constants, statuses and out parameters, as built (branch
c-bindings-enums, chapter). The chapter left these open:- An enumerator’s words and case. A word starts at each upper-case letter of the variant’s
name, a digit and
_staying with the word before them (Yuv420pone word,ColorDodgetwo,Rgb16_565→RGB16_565); they are upper case where the prefix has an upper-case letter and no lower-case one, and lower case otherwise, a prefix with no letter or none at all included. Why: it is the case rule the chapter already states, made total. Alternatives: acase:word on the mirror; matching the header’s enumerators case-insensitively, which the C unit cannot list. A name starting with a digit after the prefix (CAIRO_PDF_VERSION_1_4) is named with the variant’s own@c, and the C unit’s refusal of the derived name says so. - A mirror crosses only where the prototype writes its C type (or that type
const), not at a plainintthat happens to carry it. Why: the binding then checks that the C function means this enum. Alternative: any integer position, which loses that check. Review with the user: some C APIs take an enum’s values asint. - Duplicated values: a variant crosses as its enumerator’s value, and a value C answers is the first variant in declaration order holding it. Alternative: refusing a mirror listing two enumerators of one value, which refuses aliases a header keeps for compatibility.
- A status mirror is
Okfor zero whether or not it lists a zero variant. Why: zero is success by the binding’s form, not by the mirror. Alternative: requiring the zero variant. - Constants: an integer type takes any integer constant expression the headers define,
enumerators, characters and a
static constclang folds among them;realtakes a floating or an integer constant;stringonly a string literal, its bytes checked as UTF-8. A value its Avin type cannot hold is refused at the constant with its value.bool,charandbyteconstants are refused. Why: the three kinds the chapter names, each checked where it is read. Alternatives: narrowing silently; aboolconstant from an integer (left for when a library needs one). outandinoutare written before the parameter’s type (out int *x), the parameter a pointer to what is answered, never toconst; a parameter may still be namedout. A non-voidC result is left out where the binding’s result is the out values alone (int f(out int *a)bound as-> intanswers the out value), and is the first part where the result is a tuple of one more. Why: it is the chapter’s “a C result bound asunitleaves the tuple without it” without aunitpart to write. Alternative: requiring a tuple whose first part isunit.- An out slot starts as zero or null, so a C function that writes nothing answers zero,
None, or stops where the type has no null. A handle is neverinout: whether C kept the reference it was passed or replaced it cannot be said. Alternative: passing it in and treating what comes back as a new owned handle, which double-frees where C answers the same pointer. - An
inoutstring is passed as a NUL-terminated copy throughconst char **and read back where C pointed it, before the copy is freed, so C may move it into the copy; a string C answers through an out pointer is left to C, as a borrowed result is. - What
keeps:keeps with out handles: the holder is the handle the C result is, else the first handle answered through an out pointer, else the receiver; a status keeps only when it is zero, and aNonehandle keeps nothing.borrowedapplies to every handle the binding answers.
- An enumerator’s words and case. A word starts at each upper-case letter of the variant’s
name, a digit and
-
Settled on the user’s delegation 2026-11-05 (branch
time-instant): ADurationgiven to a millisecond wait is rounded up to whole milliseconds.Future.await(d)andCondition.waitFor(d)pass the runtime’s millisecond waitceil(d / 1ms), soawait(micros(1))waits a millisecond; a duration of zero or less asks without waiting, as a count that is not positive does. Why: a timed wait should never end before the time it was given, the rulesetTimeoutalready follows for a socket. Alternatives: rounding down, which turns every duration under a millisecond into no wait at all; a microsecond wait in the runtime, which the condition variable beneath does not offer. -
Settled on the user’s delegation 2026-11-05 (branch
time-instant):toMicrosPart()is the part below the second (micros % 1_000_000), as the chapter’s list goes fromtoSecondsPart()straight to it, with notoMillisPart(). Why: the four parts then cover a duration with nothing left over (hours below the day, minutes, seconds, microseconds). Alternatives: the part below the millisecond, which would need atoMillisPart()beside it to be complete. -
Settled on the user’s delegation 2026-11-05: An expected type reaches a core library variant that a nearer one hides (branch
none-shadowing). A module’s own variantNone(a C mirror’sImageFormat.None) hidOption‘s throughout the module, soreturn Nonefrom a-> Option[T]function,val x: Option[int] = Noneand aNonepattern on an option were all refused. Now, where the type expected at a bare variant name (every position of the shared-variant rule above: parameter, annotated binding, result, field, collection element, comparison operand, pattern) is a data type that none of the nearer variants of that name belongs to, but the core library’s variant of the name does, that variant is meant:None,Some,Ok,Err,Left,Rightand any later prelude variant. Where nothing decides it the nearer declaration wins, as the scoping order always said, soval f = Nonein that module is stillImageFormat.None; an expected type that is neither (anint,Any, a trait) also leaves the nearer one, reported against what was expected. Only the core library’s variants are reached this way: a file may not import a name its module declares, so an imported variant is never the hidden one, and an importedNonehidesOption‘s exactly as a module’s own does. Review with the user: it makes programs valid that were refused, and changes no valid program’s meaning (a use the rule now gives toOptionwas a type error before). Why: the rule for shared names is the one a reader already knows, and a C mirror’sNoneis common enough that writingOption.Nonein every option-returning function of a binding module would be a tax on exactly the code the bindings chapter shows. The undecided case keeps the nearer one because every such use was valid before and meant the module’s variant; making it an ambiguity error would breakval f = Noneandf == Nonein existing mirror modules, and would make the module’s own name second-class in its own module. Alternatives: an ambiguity error namingImageFormat.NoneandOption.Nonewherever nothing decides (no silent pick, but breaks valid programs and asks for a qualified form on the module’s own type); leaving shadowing as it was and requiringOption.None(the status quo the bug report was about); refusing a variant named like a core library variant (would rename C enumerators). -
Settled on the user’s delegation 2026-11-05: The language server’s
workspace/symbolandtextDocument/foldingRange(branchlsp-symbols-folding). Workspace symbols are read off each file’s parse, for every program an open document belongs to, its unopened files included and its dependencies’ left out; a name matches a query holding its characters in order (a subsequence), ASCII letters in either case; at most 500 symbols are listed, in file order, for any query. A symbol’s location is its name, its container its module, or its type for a method, a variant or a machine’s state; an actor is listed once, as its class, and compiler-written members (names with a$) are not listed. Folding is by whole lines, from the lexer’s blocks (the line before an indent to the last line of code before the matching dedent), multi-line tokens, comment runs, the import run and, in a literate file, runs of program text; two regions of the same lines are listed once, the block’s kind winning. WHY: the parse is there while the program has mistakes, as the outline’s is; a subsequence is what editors’ symbol search does; 500 is more than a person reads and small enough to answer per keystroke; the lexer’s indent and dedent tokens already know comments, text blocks and bracketed continuations, which a reading of indentation alone would not. ALTERNATIVES: symbols from the checker’s index (absent while the program has a syntax error, and it holds no declarations of its own); prefix or fuzzy-scored matching ranked by score (fine to add later; the protocol leaves ranking to the client); Unicode case folding (needs a case table the compiler does not have); no cap, or a cap only for the empty query; folding by indentation alone. Review with the user: whether ranking by match quality is wanted, and whether a machine’s compiler-writtenstate()/handle()should be listed (they are, at the machine’s name). -
Settled on the user’s delegation 2026-11-05: An arm no value can reach is an error (branch
unreachable-arms). An arm of amatch, amatchfunction, an actor’sreceiveor a machine state, and a clause of a function, is an error when the arms before it without a guard already match every value it would: after_, after a binding, after a pattern covering the whole type, or covered by several earlier arms together. The message names the earlier arm that alone covers it, by pattern and line, “this arm is never reached: the arm_on line 3 already matches every value it would”, or says the arms before it do together. Where the covering arm binds a name spelled as a type or a variant is (an upper-case first letter), it adds “Livebinds a new value there, since no variantLiveis in scope”. A guard never hides the arms after it; a clause hides the ones after it only when one of its bodies has no guard; a clause body after a body with no guard is an error too. Reachability is decided on the coverage matrix, so it knows what coverage knows (variants,true/false, literals, ranges, comparisons,n + k, strings by equality, sequences by length, nesting); an extractor or a type test is taken to match every value in the arm judged and none in the arms above it, so an arm is called unreachable only when it is, whatever the extractors answer. A machine state’s own arms are judged against each other; the sharedreceivearms, which a state may override by handling an event itself, are judged against each other once. A match whose patterns already failed to check is not judged. WHY: an armLive -> …meant as a variant that was not in scope bound a new name, matched every phase, and hid the arms after it: the actor runtime hung and spun at 900% CPU with nothing reported. A dead arm is always a mistake, either in the arm or in an arm above it, and it is found by a check the compiler already makes. ALTERNATIVES: a warning (Avin has no warnings channel; every diagnostic is an error, and a warning shown only sometimes is the one that is missed); an error only after an irrefutable arm (catches the bug that prompted this, but notSome(_)beforeSome(0), which is as dead); leaving it as it was. Review with the user: whether two identical extractor arms (Even() -> …twice) should count as unreachable, since an extractor is a function that could answer differently each time. -
Settled on the user’s delegation 2026-11-05: C arrays as pointers and
blockingcalls, as built (branchc-bindings-arrays, stage 13 step 6, chapter). The chapter left these open:- An
Array[int]orArray[long]goes only to a pointer to a signed integer of its size; anArray[byte]to any one-byte integer; anArray[real]to any eight-byte floating-point type, typedefs included, all checked by the C unit (__builtin_classify_type,sizeofand(T)-1 < (T)0). Why: “the element types must be the same size and kind, and nothing is converted” — an unsigned element read as anintwould turn its upper half negative, which Avin has no unsigned type to hold, while a byte is an octet of no sign. Alternatives: any integer of the size (silently reinterpreting unsigned elements); only the C types the chapter lists by name (which refusesFT_Fixed *,aa_octet *and every typedef). Review with the user: an unsigned element array (uint32_t *pixels) needs a binding per element or a buffer. length(data)is written first, before the parameter’s type and beforeinout(length(buffer) inout FT_ULong *length), asoutandinoutare; a parameter may still be namedlength. It marks an integer of C’s keywords (notchar, not an enumeration) or a typedef, which the C unit checks to be an integer. Alternative: after the type, which reads as part of it.- An
Optionof an array is accepted wherever an array is, not only beside aninoutlength:Nonepasses null and a length of zero to any binding. Why: C that takes null for “no data” is common, and the rule is the chapter’s forinout. Alternative: only beside aninoutlength. - An array’s length crosses as an
intconverted to the length’s C type, so an array too long for anunsigned charlength stops the program at the call, naming the length’s type and the array (“value out of range for u8 (unsigned char), the length ofp“). A length C writes back throughinoutis read as an out value, then compared with the array’s length, the program stopping where it is greater;Nonebounds nothing, since it asks C the length it needs. - Every array position crosses as a pointer in place unless the call is
blocking: the collector never moves an object and no collection runs while a call that is notblockingholds the thread, so nothing is copied; ablockingcall is passed a copy off the heap (an empty array’s a byte long, so C is never passed null for it), copied back only where the pointer is notconst, and freed once the thread is running again. Alternative: copying for every call, which costs the common case for nothing. - A
blockingcall keeps each handle it is passed alive across the wait by using its object afterleave_safe, so the collector, running while the call waits, cannot give the C pointer back under C. Alternative: relying on the caller holding it, which a temporary argument does not. - Arrays of mirrors, strings, handles,
booland the narrower integers are refused with the four element types the chapter lists; arrays of mirrors arrive with struct mirrors (step 7).
- An
-
Settled on the user’s delegation 2026-11-05 (built on branch
sysl-generic-bindings): generic bindings are bounded byBoundary(Sysl bindings). A binding’s type parameters, a generic handle class’s, and a bound method’s own are each bounded byBoundary, a core trait the compiler decides from a type’s structure as it decidesSendable: the integers of 8, 16, 32 and 64 bits,byte,real,char,bool,unit,string,@syslmirrors, andOptions,Results and tuples of these, and a type parameter bounded by it. It is only a bound: not a type, and no impl, trait or derivation declares it. Each call’s type arguments are held to it as to any bound, a generic function passes its own type parameter on only where that one is bounded by it too, and every instantiation gets a shim of its own that Sysl checks, so a Sysl bound the instance does not meet is reported at the binding in Sysl’s words; an Avin bound beside it ([T: Boundary & Ord]) is Avin’s to check, with no mapping between Sysl’s traits and Avin’s. A generic handle class,@sysl("m.Signal") class Signal[T: Boundary], names the generic type without arguments, its type parameters invariant and the Sysl type’s in order; each instance the program uses is a handle of its own on the Sysl type’s instance, with its own finalizer, spelled by the shim from the instance’s types, so a mirror may be a type argument (the annotation-text instances keep their narrower rule). Rationale: the declaration can be checked once and every instantiation is then sound by the bound machinery that already exists, including through a library’s generic wrappers, with no instantiation-time diagnostics in lowering (which reports none); “one Sysl type” is what a handle’s instance needs and what keeps a type argument’s Sysl type the same in both directions. Alternatives weighed: unbounded type parameters checked per call at concrete types only (refuses every generic wrapper, or needs a closed-world pass in the checker that does not exist); an implicit bound, never written (hides why a wrapper’sTis refused); admitting collections (their Sysl type is a slice going in and a slice or aBufcoming out, so aTa Sysl function stores would not be one type) and handles (one goes into Sysl only by itself, soOption[T]at a handle could not cross in); a mapping from Sysl traits to Avin bounds (no table exists, and Sysl checks its own bounds anyway). Review with the user: the nameBoundary, and whether handles should become type arguments of generic handles (Signal[View]), which needs the shim to pass a handle inside a generic Sysl value. -
Settled on the user’s delegation 2026-11-05 (built on branch
sysl-generic-bindings): a callback closure’s parameters are written out where Sysl cannot infer them. A Sysl closure taking the function’s own type parameter (applied[T, U](x: T, f: &Fn(T) -> U)) left the shim’s lambda(q0) -> …untyped, which Sysl refuses, for generic and non-generic bindings alike; the shim now writes each parameter as the Avin type’s Sysl spelling on that diagnostic, and is rebuilt for as long as each build names something more to write out (the lambda’s types first, the integer answer after), not once. Rationale: the same retry the shim already made for integer answers and parameters, extended. Alternatives weighed: always typing the lambda (wrong where Sysl hands a collection as aBufrather than a slice, which only inference gets right); refusing such bindings. -
Settled on the user’s delegation 2026-11-05 (branch
actor-isolation): A send hands a message’s handles to the receiving actor, not into transit (actors). The settled ownership decision says a send puts a message’s handles in transit for their first user, the receiver, and that the sender’s later use traps.ActorRef.tellknows the actor the message goes to, so the handles the sender owns are handed straight to that actor’s owner as the message enters its mailbox. Why: in transit, a sender that uses a handle before the receiver does would take it back, and the trap the decision promises would depend on a race; handed to the actor, the sender’s next use always traps. A message dropped because the actor has ended hands nothing over, so its handles stay the sender’s. A reply to anaskcompletes a future, which already puts its handles in transit for the waiting code. Alternatives weighed: in transit as written (racy, as above); handing over when the receiver takes the message off its mailbox (too late: the sender could have used the handle meanwhile). Review with the user: it refines the wording of a decision the user settled. -
Settled on the user’s delegation 2026-11-05 (branch
actor-isolation): Handing a value over stops at what is shared between owners. The runtime’s walk follows every object a value reaches, so a message holding an actor’s reference walked into that actor’s state and handed its handles away (an actor that spawned a child capturing its own reference lost its connections to the child). The standard library marks the types shared between owners@keeps_owners—ActorRef,Timer,Future,Promise,Executor,Channel,Mutex,Condition,Once,Atomic,Thread,Scope— and their type records carry the mark, at which every walk (a send,spawn, a thread’s or a future’s body, completing a future) stops: their handles keep their owners, as a channel’s values already do.Behaviouris walked, since its start’s captures are what the new actor owns. The mark is the standard library’s alone. Alternatives weighed: a walk the compiler writes for each type (exact, but a collection’s nodes are untyped to it); a marker trait instead of an annotation (visible to every program, which could then hide its own handles from a send). -
Settled on the user’s delegation 2026-11-05 (branch
actor-isolation): Which messages a send walks. A send walks its message where its type may hold a handle: a handle; a tuple, data type or class with a field that may; a generic type of the standard library, its collections andIsolatedamong them, at a type argument that may, or that keeps a function (Behaviour); a function value; andAny, a trait, or an open or abstract class, which may hold anything. A@keeps_ownerstype and the scalars and strings never are. Decided per type where the program is compiled (the actors’ intrinsicholds_handles), so a message of numbers, strings, actors’ references orVector[int]costs no walk. Alternatives weighed: walking every message (pays for every send); a standard library generic type judged by its fields too (aVector[int]‘s nodes holdAny, so every vector would be walked). -
Settled on the user’s delegation 2026-11-05 (branch
actor-isolation):@isolating, the mark ofisolate‘s body andwith‘s function (what is shared). The rule ofisolate‘s body is@isolated‘s (only sendable values from around it) and the whole-program check that nothing it runs reaches module-level mutable state;@isolateddeliberately leaves out the second half for a mutex’s body. A third mark between@isolatedand@sendablecarries both, and a program’s own function that isolates what its caller passes writes it too: a parameter so marked is passed on for@isolatingor@isolated, and a@sendableone for@isolating, but not the other way. It allows capturing avarof the code around it, since the body runs at once. Alternatives weighed: holding every@isolatedargument to the module-level check (a mutex’s body was thought to have no need of it, which themutex-isolatingentry below corrects); an annotation only the standard library may write (a program could then not wrapisolate). Review with the user: it adds a third annotation users can write, beside@sendableand@isolated(a mutex’s value and body take it too, below). -
Settled on the user’s delegation 2026-11-05 (branch
actor-isolation):withholds anIsolated‘s objects while its function runs. Twowiths of oneIsolatedon two threads would change one graph at once, and atakefrom insidefwould hand the objects out whilefstill works on them. Sowithmoves theIsolatedfrom held to in use by one atomic compare-and-set and back whenfreturns; atakeorwithmeanwhile traps with`Isolated` is in use by `with`, and awithafter ataketraps as a secondtakedoes (`Isolated` was already taken). A trap insidefleaves it in use. Alternatives weighed: a lock that makes a secondwithwait (an actor holding it would stall a worker, and awithfrom insidefwould deadlock); no check (a data race). -
Settled on the user’s delegation 2026-11-05 (branch
actor-isolation): WhereIsolatedlives.Isolated,isolateare inavin.actors(the chapter that defines them), imported asimport avin.actors.{Isolated, isolate}; a thread passes one through a channel the same way.Isolated(objects)may be called directly, its parameter marked@isolating, asMutex(value)‘s is. Alternatives weighed: the core module (imported everywhere, though only concurrent code wants it);avin.threads(the actors chapter names it). -
Settled on the user’s delegation 2026-11-05 (branch
mutex-isolating; found onactor-isolation): a mutex’s value and itswithbody are@isolating(synchronization). Under@isolated,m.with(b -> cache = b)on the main thread stored the buffer in a module-levelvar, so the main thread could change it later without the lock while a worker changed it under the lock;Mutex(make()), wheremakekeeps the buffer it returns in a module-levelvar, did the same at construction. Both parameters now take the whole-program check that nothing they run reaches module-level mutable state. The cost: a body may not read a module-levelvar(or a module-level value of a type that is not sendable) even where it stores nothing; it reads a local copied before thewithinstead. Module-levelvals of sendable types, another mutex among them, stay readable, so nestedwiths on two module-level mutexes are legal. Alternatives weighed: a narrower rule refusing only a flow of the guarded value into module state while still allowing reads of modulevars (an escape analysis through every call, field, collection and closure; the store can go through a modulevalof a mutable collection or an object’s method, so the rule is the same whole-program reach with flow tracking on top, harder to make sound and to explain in one diagnostic); leaving the constructor@isolated(keeps the same hole open through the value’s maker). Review with the user: awithbody that only reads a module-levelvarcounter is now refused. -
Settled on the user’s delegation 2026-11-05 (built on branch
c-bindings-callbacks, stage 13 step 9, chapter): C callbacks, as built. The chapter left these open:- A function pointer finds its
userdataby name: the function pointer’s own prototype marks exactly one parameteruserdata, and the binding marks one of the same name, which carries it (void (*listener)(userdata void *data, …)besideuserdata void *data); each of the binding’s carries exactly one function, and a parameter taking a function is named. Why: MLT and Cairo already use one name for both, and a name says unambiguously whichvoid *goes with which function when a binding takes two. Alternatives: by position (the n-thuserdatacarries the n-th function; silent when C’s order differs), or one function per binding (MLT and Cairo need no more, but GLib-style APIs pass adestroybeside the callback). - One trampoline per binding parameter, not per C function type. Why: two bindings of one
C type may cross it as different Avin types (
intandlong, a mirror and an integer), so the conversions differ; the trampoline is a few instructions and the function it runs is the conversion. Alternative: one per C type with the conversions chosen at run time. - A callback answers a scalar, a truth value or an enum mirror, and
unitexactly where C’s function answersvoid; a string, a handle or a status as its answer is refused. Why: a string or a handle answered to C would have to outlive the call with nothing to free it. Alternative: answer a string copied into memory C must free, which no C API this stage binds expects. - What C calls a function with crosses as a binding’s result does, a string copied and
checked (or an
Array[byte], orNonefor null), a handle lent through its class’sretain— a handle class withoutretainis refused there — and a value no Avin type holds stops the program where the binding C is running was called, as the answer’s does, naming the function. forget:is a C function’s name, calledname(self, userdata), or a C expression inselfanduserdata, run in the handle’s glue for each callback it keeps, after its pointer is taken and beforerelease; a handle that keeps a handle never takes the other’s callbacks.- A kept function’s record roots it until the handle keeping it is given back. Why: the
record must outlive any call C makes, even one racing the collector on a thread of C’s own.
Consequence: a kept function that captures its own holder keeps both alive until
close(). Alternative: trace the function from the handle, which frees such a cycle but lets a C thread call a function the collector has just freed. Review with the user: whether that cycle is worth a weak record. - In a program that passes C a function, every call of a C library function may run the
collector, and is planned as one that does: any C call may call back a function C keeps. The
C unit’s glue never does. Alternative: a
calls-backword on the bindings that may, which is cheaper and trusted. - libc’s
qsortandbsearchtake nouserdata, so they cannot be bound; the corpus binds a C function of its own that callsqsort_randbsearchthrough one.
- A function pointer finds its
-
Settled on the user’s delegation 2026-11-05: on branch
c-bindings-structs(roadmap stage 13 step 7), C struct mirrors, opaque values and arrays C answers.- A mirror’s layout is measured, and checked against the header’s order. The C unit measures
each field’s offset, width and sign and the struct’s size, and asserts the fields come in the
header’s order, each where C’s alignment puts it after the one before, none after the last;
lowering reads and writes each field at its measured offset and width, with the traps of an
argument and a result. Why: a field narrower or wider than its Avin type (
uint8_tasint,floatasreal,unsigned longaslong) crosses as a scalar parameter does, and the layout is the target’s. Alternatives: a layout implied by the Avin types alone and asserted (cannot spell afloator ashortfield); matching fields by name in any order (hides a reordered header). - Every field is named, which a positional initializer checks. The unit initializes the struct
by position with one zero per mirrored field under
-Wmissing-field-initializersmade an error, so a field hidden in the padding between two others is found. For that the unit no longer passes-w; it ignores every warning with#pragma clang diagnostic ignored "-Weverything"instead. Alternative: the layout checks alone, which miss a small field in padding. - A mirror has one variant named as the type, as a Sysl struct mirror does, and its fields are
integer types,
byte,bool,real,string,Option[string](null asNone), enum mirrors and other struct mirrors. Why: FreeType’s and Cairo’s structs carry nullable names. Alternative:stringonly, a stop on null. - Strings in a mirror passed in are copies freed after the call; strings C writes into a mirror
are copied out and left to C, as a borrowed string result is. Alternative: a
free:per field, which no surveyed struct needs. - Every out value stays in the result, the array’s length too, where
array:names the array. Why: one rule for out values. Alternative: dropping the out valuelength:names. - An array C answers that is null is
Nonefor anOption, an empty array where its length is zero, and a stop otherwise; a negative length, or one past anint, stops the program; the array is freed byfree:(a function or an expression in the array’s name, optional for memory C keeps) after it is copied, and unread where a status fails. Review with the user: whetherfree:should be required witharray:. - Opaque values cross by value only: a parameter, a result and a method’s
self, never through a pointer,inoutor in anOption; each object is its own, compared by identity, and sendable, since it is an immutable copy. Alternative: alsooutandconst T *, which no surveyed binding needs.
- A mirror’s layout is measured, and checked against the header’s order. The C unit measures
each field’s offset, width and sign and the struct’s size, and asserts the fields come in the
header’s order, each where C’s alignment puts it after the one before, none after the last;
lowering reads and writes each field at its measured offset and width, with the traps of an
argument and a result. Why: a field narrower or wider than its Avin type (
-
Settled by the user 2026-11-06: concurrency that waits is written as straight-line blocking code, run on lightweight threads; Avin has no
asyncorawaitkeywords. A lightweight thread is a runtime-scheduled thread with a stack of its own; a few operating system threads, about one per core, run whichever are ready. A call that would wait (a socket read,Future.await, a channel,sleep, a lock) parks only its lightweight thread: the runtime records what it waits on (a socket through the runtime’s poller over kqueue or epoll, a future, a timer), and runs another on the same operating system thread.spawn, the futures’ pool and actors’ turns come to run on lightweight threads, so the APIs that exist today keep their meaning and become cheap; a server holds one lightweight thread or one actor per connection, and a connection that waits holds no operating system thread. Concurrency stays explicit:Future(body)to start work andawait()on it,Future.allandFuture.first, channels andscope. Why: no division of functions into those that may wait and those that may not, so one library serves every caller and any function at any depth may wait; an ordinary call allocates nothing; existing code needs no change. Alternatives: stacklessasyncfunctions compiled to state machines (smaller per waiting task, in the hundreds of bytes, but every function on the path to a wait markedasync, libraries split in two, and an actor’s state open to change at eachawait);async/awaitas sugar over lightweight threads (async defaFuture,await ee.await()), declined as a second spelling of whatFuturealready says. Consequences: a stack per lightweight thread, reserved large and committed as touched (at least a page, 16 KB on arm64, per lightweight thread), with moving parked frames to the heap a later reduction; the collector scans parked stacks; a C call that blocks holds its operating system thread, asblockingalready accounts for. -
Settled on the user’s delegation 2026-11-06: lightweight threads are time-sliced at safepoints. A lightweight thread that has run for its slice, 10 ms to begin with and tunable, yields at its next safepoint poll and goes to the back of the ready queue, so threads that never wait share a core instead of starving the others. A timer in the runtime raises the yield request on the carrier running it; compiled code already polls a flag on every back edge of its control flow and before every call that may recur, for the collector, and the same poll answers it, so a thread that does not overrun pays nothing more. A wait still switches at once, and an actor’s turn still ends after 16 messages. A long C call cannot be interrupted;
blockinglets another carrier run in its place. Built with the scheduler core. Why: fairness for computation-heavy threads at no cost to the rest, from a poll that exists already, with every interruption at a point where the roots are exact. Alternatives: switching only at waits (a long computation holds its carrier until it ends); interrupting at any instruction by a signal (needs exact roots at every instruction, which the shadow stacks give only at safepoints). -
Settled on the user’s delegation 2026-11-06: The allocation chunk belongs to the carrier, a runtime record per operating system thread, and a context reaches it through a pointer (branch
lwt-carrier-chunk).Context.carrierpoints at theCarrierthe context runs on, which holds thegc.Chunk; allocation readsctx.carrier.chunk, one load more than before, and compiled code never touches the chunk, so lowering is unchanged. Attaching a thread makes its carrier (a record that keeps itself alive) and links it into a list of carriers beside the list of contexts, both under the heap lock; detaching retires the chunk, unlinks the carrier and frees it, and detaching twice changes nothing. A collection retires the chunk of every carrier rather than of every context. A context’scarrieris stored only while the context is safe, by one store, so a later scheduler moves a lightweight thread between carriers without moving a chunk. Why: thousands of parked lightweight threads must hold no chunk each, and the chunk is a property of the thread that is running, not of the code it runs. Alternatives: the chunk kept in the context and handed over at each switch (a copy of the chunk’s six words per switch, and every parked context still sized for one); a thread-local carrier found through the platform’s thread-local storage (no pointer in the context, but a thread-local access on every allocation, dearer than one load); the carrier embedded in the thread’s own storage beside its context (no separate record, but a carrier would then die with the context it was made beside, which is wrong once contexts outnumber carriers). -
Settled on the user’s delegation 2026-11-06 (branch
lwt-scheduler): the scheduler is one ready queue under one lock, run by workers started one at a time as threads become ready, up to one per processor. A thread made ready goes to the back of the queue; an idle worker sleeps on a condition and is woken for it, and where none is idle and fewer workers than processors are counted, another is started. A worker is an operating system thread with a carrier of its own that runs no compiled code itself: it switches to a lightweight thread and back, and after the switch back does what the thread asked (let a guard go, re-queue it, give its stack back). Why: the simplest correct queue, with every wake in the order threads became ready, and the lock is held for a few instructions. Alternatives: a queue per worker with stealing (less contention on many cores; more code, and no ordering between workers), left for when a measurement asks for it; starting every worker at once (simpler counting, but a program with one thread would start one per processor). -
Settled on the user’s delegation 2026-11-06 (branch
lwt-scheduler): a lightweight thread’s stack keepsspawn‘s 8 MiB default, reserved throughsysl.fiberand committed as touched, with 64 KiB at the least; the stacks of ended threads are kept, 64 at most, for threads asking about the same size. Why: the default costs address space only, so every program that recursed deeply in a thread before still does, and a reused stack saves a mapping and its guard per short thread. Alternatives: a smaller default such as 1 MiB (less address space at a hundred thousand threads, but deep recursion that fitted in a thread would overflow); no reuse (a map and an unmap per thread). Review with the user: the default is the knob most likely to want a different value once servers hold many thousands of threads. -
Settled on the user’s delegation 2026-11-19 (branch
lwt-stacks): a lightweight thread’s stack stays one fixed reservation, 8 MiB unlessspawn‘sstackasks otherwise and 64 KiB at the least, and the runtime gives its pages back: the monitor trims a thread it has seen parked at two ticks with no run between, down to 16 KiB below where it parked, and a stack kept for reuse is trimmed to its top 16 KiB as its thread ends. This settles the Open item on stack size and growth. A worker marks a parked thread settled after it has switched away and lists it; the monitor raises the thread’strimmingmark and only then looks for it parked and settled, while a worker about to run it marks it running and unsettled and only then waits fortrimmingto fall, so a trim never overlaps the thread’s next run. The release ismadvise(MADV_DONTNEED)on Linux; on macOS that advice leaves the pages resident, so the range is mapped afresh in place (MAP_FIXED), which frees them at once (runtime/avin/rt/__posix__/stack_release.c). A release the system refuses leaves the range as it was, mapped and committed (a failedmadvisechanges nothing, and a fixed mapping the kernel cannot make puts the old one back), so the runtime only counts it (stack_releases_refused) and the thread goes on untrimmed; nothing traps. The overflow trap is untouched: the guard and the report’s low end are the stack’s own, and a trimmed stack still overflows at its end withstack overflow. Measured (macOS, arm64, 16 KiB pages,-O2, resident bytes per parked thread after its recursion returned): depth 0, 17 KB before and after; depth 1,000, 66 KB before, 34 KB after; depth 10,000, 493 KB before, 34 KB after (1,000 threads: 470 MiB before, 32 MiB after). 100,000 shallow parked threads hold 1.6 GiB either way, a page and a record each. Deepest recursion, main thread and spawned thread alike, unchanged: about 40,000 calls at-O0and 50,000 at-O2of a one-argument function. A two-thread rendezvous ping-pong (two parks a round trip) and a start-and-join churn showed no slowdown beyond the machine’s noise (round trip 1.0–2.1 µs after against 1.8–2.9 µs before, interleaved runs). Amadviseof an 8 MiB stack costs about 20 µs on macOS whether or not its pages are resident, and the fresh mapping about 0.3 µs, which is why the release is the mapping there and why it is done by the monitor after a tick rather than at every park. Alternatives: trimming at every park (a system call a park, a third or more of a rendezvous round trip); stamping each park with the clock (a clock read a park, where a run count is two stores); copying or segmented stacks that grow (refused: C frames and the native frames the collector’s shadow stack points into cannot move, and a segment boundary in a C call has nowhere to go); a soft guard page below where a thread parked, unprotected by the fault handler when the thread goes deeper (refused: a system call writing into that page first getsEFAULTinstead of a fault); moving parked frames to the heap (the same objection as copying). Review with the user: the 8 MiB default and the 16 KiB kept below a parked thread, and the namestackofspawn‘s size parameter, which the trimming makes less pressing to change but which a server author may still want to set lower to bound address space. -
Settled on the user’s delegation 2026-11-06 (branch
lwt-scheduler):mainstays on the program’s first operating system thread and is not a worker; its waits block that thread. Every wait has two forms: a lightweight thread parks, and any other thread (the main thread, a thread attached for a callback) sleeps on one shared condition until its own waiter is woken. Why: the main thread stays free for theuipackage, which must run on it, and a program whosemainnever waits keeps its whole processor count of workers. Alternatives:mainas a lightweight thread run by a worker, with the first operating system thread one of the workers (one kind of wait, but theuipackage would then need a way to pin a thread to it, which is the open main-thread question). -
Settled on the user’s delegation 2026-11-06 (branch
lwt-scheduler): time-slicing answers at the existing poll by a second bit of its flag.requestedholdsStop(1), raised by a collection, andYield(2), raised by the monitor, a runtime thread that ticks every millisecond while a worker is busy, when a worker’s thread has run 10 ms while another is ready; it also sets that worker’s ownyield_wanted. A poll still loads the word and branches on zero;avin_rt_safepointwaits out aStopand then, on a worker whose flag is set, yields to the back of the queue, and lowersYieldonce no worker wants it. Any lightweight thread yields at any poll, inside a lock or a callback too. Why: compiled code is unchanged and pays nothing while nothing overruns; while one does, the others’ polls take the slow call for at most a tick. Alternatives: a flag per carrier read through the context (no spurious slow calls, but two loads per poll and a compiler change); not yielding inside a lock (the lock’s waiters park anyway, so it buys nothing and lets one thread hold a worker). -
Settled on the user’s delegation 2026-11-06 (branch
lwt-scheduler): a blocking call is noticed, not announced:enter_safemarks the carrier blocked and counts the call, and the monitor releases a worker that has stayed blocked across a whole tick while threads are ready. A released worker is not counted against the target, and another is woken from the spares or started; when the call returns the thread runs on, and its worker rejoins the count at its next switch, or rests as a spare where the count is full. This generalizes the pools’blockingcompensation to every blocking binding,sleepand a wait for alazy val. Why: a call that returns within a tick costs two stores and starts nothing, and the generated shims and every binding stay as they are. Alternatives: compensating at every blocking call (a thread start or wake per call, however short); a pool of threads for blocking calls only (every such call a hand-off between threads). -
Settled on the user’s delegation 2026-11-06 (branch
lwt-scheduler): every lock and condition parks:Mutex,ConditionandOnceas well as channels, futures, promises and joins. The runtime’s one lock and one condition, which all of them are built on, keep a queue of waiters; a lock let go goes straight to its oldest waiter. The brief plannedMutexandConditionfor the next step, keeping them blocking until then. Why: channels, futures’ cells and the pools are built on the very lock and conditionMutexuses, so keepingMutexblocking meant a second, temporary implementation of both; and aMutexwhose holder parks can then never hold every worker. Alternatives: a parking lock and condition beside the blocking ones, used by channels and futures only, until the next step (two implementations, one to remove). Review with the user: it moves part of the next step into this one. -
Settled on the user’s delegation 2026-11-06 (branch
lwt-scheduler): a context waits as the one waiter it holds, since a thread waits on one thing at a time; a timed wait of a lightweight thread is a timer the monitor fires, added by the worker after the thread has switched away and taken off by the thread when it runs again. Why: no waiter is ever made per wait, and no waiter is reachable once its wait has answered. Alternatives: a waiter in the waiting function’s frame (the same, but its address is a local’s, which Sysl’s escape check refuses to queue); a heap waiter per wait (an allocation per wait). -
Settled on the user’s delegation 2026-11-06 (branch
c-bindings-buffers): views and blocks are one object layout, the runtime’sCMemory, with their operations as intrinsics ofavin.c.ByteView,MutByteView(a subclass) andByteBlock(a subclass ofMutByteView) are library classes the compiler lays out as the address, owner, length, closed flag, the two reasons they trap with and the lender; each operation is a call of the runtime that checks the code running, the closed flag and the bounds, and stops the program at the caller. Why: a class holding an address in an Avin field could be made by its public constructor with any address, since Avin has no private constructors; a layout only the compiler and the runtime fill keeps every address one C lent or Avin allocated. Alternatives: a Sysl handle per view (the view could not keep its lender, an Avin object, alive); inline MIR for every operation (more compiler, and a closed view’s reason is a string the runtime reports anyway). -
Settled on the user’s delegation 2026-11-06 (branch
c-bindings-buffers): a view’s lengths and indices areints, and a C length past the greatestint, or negative, stops the program at the call. Why: arrays’ areints, so a copy, a slice and an index mix with them without conversions; 2 GiB is more than a frame or a glyph. Alternatives:longlengths (every index writtenlong(i));longlengths withintindices (a view longer than any index reaches). Review with the user: a library lending more than 2 GiB at once would needlong. -
Settled on the user’s delegation 2026-11-06 (branch
c-bindings-buffers): null lendsNonein anOptionwhatever the length, and otherwise an empty view where the length is zero and a stop where it is not, as arrays C answers are. Why: FreeType’s empty glyph is null with no rows, and a frame with no image may answer null with a size of zero. Alternative: null always a stop outside anOption. -
Settled on the user’s delegation 2026-11-06 (branch
c-bindings-buffers): a view belongs to the code owning its lender, and is lent only by a method of a handle that is notshared. A view checks its lender’s owner at each use, so handing the lender over (a thread’s body capturing the view or its frame) takes the view with it and any other thread traps. Why: closing a view is a write the lender’s next use makes, and reading memory the lender’s next call may free; both must happen on one owner at a time, which asharedhandle does not have. Alternatives: an owner of the view’s own (a view handed over without its lender would race the lender’s next use);sharedviews closed under a lock (a lock per byte read). -
Settled on the user’s delegation 2026-11-06 (branch
c-bindings-buffers): a failed status lends nothing and copies nothing, but is a use of its receiver, which closes the view lent before it. Why: the call ran, and may have freed the memory. Alternative: closing only on success (a stale view after a failed conversion). -
Settled on the user’s delegation 2026-11-06 (branch
c-bindings-buffers): the recordattach:gives C belongs to one handle object: later keeps through the same handle add to it, the handle lets go of it when its reference goes back, and C holds it untildestroy; on anattach:class every kept object, handles too, is held as its Avin object, so a kept handle’s own C reference lives as long as the record.key:may be left out (acharof the class’s own keys the record), andattach:withsharedis refused. Why: the record’s slot is reused only once neither the handle nor C holds it, so a handle never updates another’s record; holding kept handles as objects keeps their references alive past the holder’sclose(). Alternatives: one record per C object, found through the library’s own getter (no getter is named, andattach:would need a second expression); C references for kept handles (given back with the holder’s handle, while C still uses them). Review with the user: two Avin handles on one C object each attach under the same key, so the second replaces the first’s record, and C’s destroy of the first lets go of what the first kept while the first handle still keeps it. -
Settled on the user’s delegation 2026-11-06 (branch
c-bindings-buffers): aByteBlock‘s own constructor makes a block of no bytes, passed to C as null, andByteBlock(length)is the companion’sapply. Why: a class has a constructor, and the empty block is harmless where every index is out of range. Alternative: an abstract class with a factory (a block could not be named as the typeByteBlock(n)makes). -
Settled on the user’s delegation 2026-11-06 (branch
c-bindings-buffers):bytes:isarray:for anArray[byte], withfree:where C allocated the bytes. Why: the spec’s copy was the one-element case of the generalizedarray:; one path copies both. Alternative:bytes:with nofree:(a leak per call for a library that allocates). -
Settled on the user’s delegation 2026-11-06 (branch
lock-turn-leak): a join answers only once the ended thread keeps nothing alive (threads). An ending lightweight thread detaches its context (its frames, which hold its closure and its joint, stop being roots) and then marks its joint done and wakes its joiners, both under the heap lock, so no collection runs between the two and the joint outlives its last use even when nothing else reaches it. Why: before, the joint was marked done first, so a collection right after a join could still find the closure and the joint through the ended thread’s frame; a program saw its memory freed one collection late, and a runtime test asserting an empty heap after a join failed under load. Alternatives: keep the old order and promise only that an ended thread’s objects are collected eventually (weaker, and visible to any program measuring its heap); or clear the frame’s slots before marking the joint done (the joint, then reachable from nothing for a thread nobody joins, could be collected while the ending thread still writes to it). -
Settled on the user’s delegation 2026-11-06 (branch
lwt-timers):sleepparks a lightweight thread on a timer, and the monitor thread fires the timers.sleepin a lightweight thread parks it with no guard and a timer at its deadline, as a timed wait parks, so its worker runs other threads;mainand other threads that are not lightweight block, safe for the collector. The monitor, which already wakes once a tick while any worker is busy and sleeps until the soonest timer while none is, fires the timers that are due. Why: the monitor exists, already fires timed waits and already sleeps until the soonest one, so sleeps need no thread of their own and no new wake-up path; a sleep is never more than a tick late while workers are busy. Alternatives weighed: the poller’s timeout (the poller of sockets, step 4, is not built yet; once it is, its wait could take the soonest timer as its timeout and the monitor could hand timers over, which this choice does not preclude); a timer thread of its own (one more operating system thread doing what the monitor does); keepingsleepa blocking call that the monitor compensates for (a worker per sleeper, which is what the lightweight threads are for). Review with the user only if sleep precision under 1 ms matters. -
Settled on the user’s delegation 2026-11-06 (branch
lwt-timers): the timers are a binary heap of waiters keyed by deadline, ties broken by the order they were set, each waiter keeping its place in the heap. Adding, firing and cancelling a timer each cost O(log n) under the timer lock, and reading the soonest is O(1); threads whose time runs out together are made ready soonest first, and two due at the same microsecond in the order they began waiting. A timed wait that its event ends first takes its own timer off when it runs again (its place makes that one step, not a search); the timer and the event race on the waiter’s state, and only the one that changes it from pending makes the thread ready, so a wait answers exactly once and leaves no timer behind. Why: the linear list cost a scan per cancel and per tick, which ten thousand sleepers turn into a hundred million steps a second; a heap of the waiters themselves needs no allocation per timer beyond the heap’s array. Alternatives weighed: a hierarchical timing wheel (O(1) add and cancel, but a tick-quantized deadline and more machinery than a heap that is already fast at this scale); a sorted list (O(n) insertion); a heap without places (cancel would search, O(n)). -
Settled on the user’s delegation 2026-11-06 (branch
unix-sockets): Unix domain sockets inavin.net:UnixStreamandUnixListenermirrorTcpStreamandTcpListener, sharing the read-ahead code (read,readLine,readAll) through one private class both hold;UnixListener.bind(path)fails withAlreadyExistswhere anything is at the path, and the separatebindReplacing(path)removes a socket file nobody listens on (a probing connection is refused) before binding, leaving a live listener’s path and any non-socket file alone;close()leaves the socket file; a path the platform cannot carry (103 bytes on macOS, 107 on Linux) is anErrwith the platform’s message, and a connect to a path with nothing at it isNotFound. Waits are the TCP ones: blocking bindings that park the lightweight thread’s carrier as TCP’s do, with no poller integration. WHY: a daemon and its command-line client need a local socket with the API they already know from TCP; silently deleting an existing path could remove another program’s live socket or an unrelated file, so the safebindrefuses and the replacing form is explicit. Alternatives weighed:bindalways removing a stale file (a surprise on a path that is a live socket or not a socket at all);close()removing the file (wrong for a listener handed between threads, and a second program may already have replaced it); one sharedStreamtrait over TCP and Unix (no use yet, and the language’s traits would add a dispatch to every read). Review with the user:bindReplacing‘s probe connection is seen by a live listener as an immediately closed connection.
Open files in avin.fs (branch fs-file, for the job manager’s log following and event log; the
system library chapter has the surface). Each choice below the
spec did not settle, each settled on the user’s delegation 2026-11-06. Review with the user: the first two (a File kept to one thread, and no seek from the end).
-
Settled on the user’s delegation 2026-11-06: the type is
File, opened byfs.open,create,append,openUpdateandcreateUpdate. WHY: the five modes cover every combination a program asks for, named for what happens to what is already there, as Sysl names them, and the whole-file functions keep their names. ALTERNATIVES: anOpenModeargument (one function, but a mode a program can get wrong at runtime and a longer call for the common case); only read, create and append (no way to overwrite part of a file). -
Settled on the user’s delegation 2026-11-06: a
Fileis notSendable. WHY: its Sysl handle belongs to the thread that opened it, and a program that wants another thread to use a file opens it there;TcpStream‘s hand-over machinery buys nothing for a file a program can reopen. ALTERNATIVES: make itSendablewith the owner check aTcpStreamhas. Review with the user if a file must move between actors. -
Settled on the user’s delegation 2026-11-06: seeking is from the start only, plus
seekToEnd(); a negative offset is anErr, a seek past the end is allowed. WHY: following a log needs “start at the end”, and a tail needs absolute offsets, whichsize()gives; offsets back from the end aresize() - n, with no second vocabulary. ALTERNATIVES: aWhenceargument; a signed offset meaning from the end. -
Settled on the user’s delegation 2026-11-06:
readLineanswers an unterminated last line;readCompleteLinedoes not, and leaves the partial line unread. WHY: a file followed while another program writes it shows half a line at some moment, and a follower must not act on it; a file read to its end wants the last line even with no\n. ALTERNATIVES: onereadLinewith the first meaning (torn lines when following), or the second (the last line of a file with no final newline lost). -
Settled on the user’s delegation 2026-11-06:
read(max)and the line calls share one buffer of theFile‘s own, andposition()is the logical position (the file’s, minus what is buffered and unread). WHY: lines need a buffer, andread,seekandwritehave to agree with it. Awriteorseekgives the buffered bytes back first. ALTERNATIVES: separate byte and line modes (a program mixing them gets surprises). -
Settled on the user’s delegation 2026-11-06: a read at the end is not sticky. WHY: following a growing file is the point; the next read asks the file again. ALTERNATIVES: a latched end that
seekclears (Sysl’s own flag is not used). -
Settled on the user’s delegation 2026-11-06: misuse is an
Err, not a trap: a call on a closed file, a read of a write-only file, a write to a read-only one, a negative seek offset; a negativemaxorcountor tail size traps likeTcpStream.read‘s, being a program mistake at the call. WHY: the first group depends on the state the program’s files are in at runtime. TheErrfor those isOtherwith a plain sentence, asTcpStream‘s closed connection is. ALTERNATIVES: a dedicatedIoErrorvariant for a closed file (more to match on for a rare case). -
Settled on the user’s delegation 2026-11-06:
readTail(file, maxBytes)answers text, begins at a whole character, and replaces invalid bytes with U+FFFD;readTailLines(file, count)answers lines. WHY: the caller wants to print or search the end of a log, where a cut character is garbage and an invalid byte elsewhere should not refuse the whole tail. A start inside a UTF-8 sequence skips the rest of that sequence (continuation bytes), never reading earlier bytes to complete it, so exactly the bytes asked for or fewer come back. ALTERNATIVES: back up to include the whole character (more thanmaxBytes); answer bytes and leave decoding to the caller;InvalidUtf8for a cut start. -
Settled on the user’s delegation 2026-11-06: opening a directory for reading or updating is
IsADirectory. WHY: the platform opens a directory for reading and fails only at the first read, which would show up as an unexplained failed read. ALTERNATIVES: leave it to the read. -
Settled on the user’s delegation 2026-11-06: the calls do not park a lightweight thread. WHY: the whole-file
avin.fscalls do not either, and a regular file’s read does not wait for a peer. ALTERNATIVES: bind themblocking(needed only for files on a stalled network mount). -
(Superseded by the Proposed entry JSON is
avin.jsonin the standard library.) Settled on the user’s delegation 2026-11-06 (branchjson): JSON is the packagejson, inpackages/jsonof this repository, modulejson, rather thanavin.jsonin the standard library (JSON). Why: the system library chapter already says JSON is a package of its own; the package mechanism reads a path dependency and a git dependency on a directory of a repository (//packages/json), as theuipackage is reached; and a domain library outside the standard library keeps the compiler’s library small. Alternatives weighed:avin.jsonin the standard library (contradicts the system library chapter, and every compiler release would carry it); a repositoryavin-lang/jsonof its own (premature while the derivation templates it is to carry are still being built in this one). Review with the user: whether JSON should after all ship with the compiler, since marshal and most services need it. -
Settled on the user’s delegation 2026-11-06 (branch
json): a JSON number is aLongwhen the text writes a whole number that fits along, and aRealotherwise; aRealis always written with a fraction or an exponent. Why: identifiers, counts and sizes stay exact past 2^53; writing1.0rather than1makesparse(render(j)) == jfor every finite value, kind included.-0is theLong0 (a whole number, and alonghas no minus zero);-0.0is theRealminus zero. A whole number beyond alongis aReal, rounded. TheRealform follows the usual shortest-digits rule, written out from 1e-6 up to 1e21 and with an exponent outside. Alternatives weighed: oneNum(real)(loses integers beyond 2^53); keeping a number’s text (Num(text), exact for any size but every reader parses again); a thirdBig(digits)variant for integers beyond along(exact, at the cost of a case every match must handle). Review with the user: the variant namesLong,Real,Str,Arr,Obj(chosen becauseArrayis a built-in type’s name andString/Objectread as types), and the companion’sobj/arr/str/num. -
Settled on the user’s delegation 2026-11-06 (branch
json): a number too large to be a finiterealis an error, and a NaN or an infinity is writtennull. Why: aRealholding an infinity cannot be written back as JSON, so accepting1e400would break the round trip; writingnullkeepsrendertotal, as most writers do. Alternatives weighed: reading1e400as an infinity; trapping when writing a non-finite value. -
Settled on the user’s delegation 2026-11-06 (branch
json): an object keeps every member, a key written twice included, andgetandapplyanswer the last. Why: reading is lossless and the order is the document’s, which a log or a configuration file shown back to a person needs; the last-wins lookup is what most readers do. Lookup is a scan from the end, which is fast for the objects a protocol carries. Alternatives weighed: refusing a duplicate key (strict, but RFC 8259 allows it); the first one winning; members in aMap(fast lookup, loses order or needs an ordered map). -
Settled on the user’s delegation 2026-11-06 (branch
json): arrays and objects nest at most 512 deep unlessparseis given another limit, a scalar being 0 deep. Why: the reader is recursive, and a hostile document of a million[would otherwise end in a stack overflow trap; 512 is far beyond any real document and far inside a lightweight thread’s 8 MiB stack. Alternatives weighed: no limit; an iterative reader with no limit (more code, and the values built are still recursive to write); 1000 or 10000. -
Settled on the user’s delegation 2026-11-06 (branch
json): a lone surrogate escape is an error. Why: astringholds only characters, and U+D800 is not one. Alternatives weighed: replacing it with U+FFFD (silent loss); carrying it as WTF-8 (a string that is not UTF-8). -
Settled on the user’s delegation 2026-11-06 (branch
json): an error’s line ends at a line feed only and its column counts characters; it also carries the byte offset. Why: the line feed is the only line end JSON text ordinarily has, a\r\ncounts the same, and counting characters matches what an editor shows. The place is counted out only when an error is made, so reading pays nothing for it. Alternatives weighed: a lone carriage return also ending a line; columns in bytes. -
Settled on the user’s delegation 2026-11-06 (branch
json): the accessors answerOptions,applytraps, andasLongtakes aRealthat is a whole number within along. Why: Options chain with?in a function answering anOption(j.get("a")?.get("b")?.asInt()), andapplyis for a member the program knows is there, as a map’s is; a producer writing3.0for a count is common. Alternatives weighed: a missing member answeringNull(confuses absent with null); a cursor type with its own errors (a later layer, which the derivation’sJsonReadercovers). -
(JSON’s tests have since moved to
library/tests; see the Proposed entry JSON isavin.jsonin the standard library. The rule stands for any later package with tests.) Settled on the user’s delegation 2026-11-06 (branchjson): the corpus runs every package underpackages/that has atestsdirectory, withavin testat-O0and-O2. Why: a package’s tests are whatavin testruns in it, and the repository’s own packages must be gated like the core library is. A package whose behaviour needs a window (ui) has no such directory. -
Settled on the user’s delegation 2026-11-06 (branch
process-control): AChild‘s process ids are recorded, and read by any thread (commands).pid(),group(),signalandsignalGroupread atomics the starting code writes as each program starts, never the command’s handles, which belong to one thread, so a job manager can signal a child another thread is waiting for.pid()is the program started last (a pipeline’s last stage, a sequence’s latest part, as a shell’s$!is), andsignalreaches that one program;killremains the call that reaches every program and stops a sequence. A command seen to have ended is refused with the platform’s “No such process” rather than signalled, since its id may have been given again; one that ended unseen is a zombie the signal reaches harmlessly. Alternatives:signalthrough the owner, which traps on a child another thread waits for (what the marshal survey met); asignalreaching every program, which needs every program’s id kept and the job’s handles’ state shared;pid()as anOption, rather than0for a command whose time ran out before it started a program. -
Settled on the user’s delegation 2026-11-06 (branch
process-control): One group per command, andsignalGroupwithout one is anErr(commands).inNewGroup()puts every program of the command in one group its first program leads, the outermost setting deciding; a sequence’s later part whose group has emptied leads a new one (joining a gone group is refused by the platform), andgroup()follows it.signalGroupon a command with no group of its own isErr(Other("the command has no group of its own")), never a signal to the program’s own group, and it still signals after the command ended, since a group outlives its leader while anything it started is left: the case a job manager kills for. Alternatives: a trap forsignalGroupwithout a group (a daemon would die of a missed setting); a group per part; refusing the later part. Review with the user: whethersignalGroupshould trap. -
Settled on the user’s delegation 2026-11-06 (branch
process-control): Standard error is redirected as output is (commands):errorsToFile,errorsAppendToanderrorsToOutput(), the last sharing the output’s open file (one offset, so neither stream truncates or overwrites the other), going into whatoutput()andlines()capture, and, where the output is the program’s own, opening/dev/stdoutto append. On a pipeline every stage’s errors go to the pipeline’s redirection. The redirections apply output first whatever the order they were called in. Alternatives: onebothToFile(file)(a second name for a pair of calls);Stdio-like values passed to onewithStreams;2>&1read as the output at the point of the call. -
Settled on the user’s delegation 2026-11-06 (branch
process-control): Signals are watched inavin.signal, and a wait looks every 20 ms (avin.signal). The platform’s facility is a counted flag, sowait()parks its lightweight thread and looks again every 20 milliseconds, the latency bound;take()asks once. Constants arevals named for what they mean (Terminate,Interrupt,Hangup,User1…), the user ones numbered by the runtime for the platform; sending stays inavin.processbeside the process ids it takes. Alternatives: the POSIX short names (TERM), against Avin’s naming; adata Signal(a closed set, while numbers are open, andExitStatus.Signalledspeaksint); a wake from the handler through the scheduler, which needs a runtime handler that is async-signal-safe, for a latency no program has needed yet. -
Settled on the user’s delegation 2026-11-06 (branch
nested-literal-typing): A number literal nested in an argument takes the numbers the other arguments decide (generics). An argument that is or holds an integer literal (a collection literal, a tuple, or a call other than a conversion such aslong(1), with such a part) is checked after the arguments that hold none, against the type they decided so far, and an expression of literals alone (a literal, or an operation orifon such expressions) after both, soassertEq(count(Box(1)), 1_000_000_000_000 + 1)with alongresult is alongwhichever is written first. Where the decided type would otherwise be left open so a later argument may widen it, the argument is given its shape with the value types and every invariant type argument kept, and every class or other reference leaf at a covariant place left open. SoassertEq(f(), [1, 2])withf() -> Vector[long]is aVector[long], whilesame(dogs, [Cat(2)])still joins to aVector[Animal]. Why: the chapter already says a literal takes the type the other arguments decide, and a literal one level down is the same literal to a reader. Two limits, chosen as the smallest rule: of two arguments that both hold literals, the first written decides for the second (same((1, x), (x, 2))forx: longis an error, where a part-by-part solution would type it); and choosing an overload checked a nested literal once at its own type where the candidates’ parameters differ. Review with the user: whether the first limit is worth lifting.Proposed (branch
fix-literal-expected, 2026-11-14): the second limit is lifted. Choosing an overload checks a value built around number literals by itself first, as before; where that leaves no candidate fitting (or it does not check by itself, as[5_000_000_000]does not), it is checked against each candidate’s parameter instead, with the type arguments the receiver, the lower bounds and the other arguments decide, as a bare literal is. Sokind(Some(1))besidekind(o: Option[long])andkind(o: Option[string])is thelongone, andlongs ++ [400], which met two overloads of++(Vector[W]andIterable[W]withW >: long), is aVector[long](found writing marshal). Where the literal fits candidates at its own type, the choice is unchanged, soown([1])besideVector[int]andVector[long]stays theintone. With it, a reference type that takes integers or decimals (BigInt,BigDecimal, a type implementingFromInteger) is kept in the expected type a literal argument gets, as a number is, sopair(cents, [3])forpair[T](a: Vector[T], b: Vector[T])buildsCentswhere it had built anint. Why: a literal one level down is the same literal to a reader, and an operator method on a collection is the commonest place it meets overloads. Alternatives: checking against each candidate first (would change which overloadown([1])picks, and is ambiguous where both take it); trying candidates by the literal’s structure only (more code, same result). -
Settled on the user’s delegation 2026-11-06 (branch
stdout-flush-isnan): standard output gets an explicitflush(); reading flushes it;realgetsisNaN,isInfiniteandisFinite.flush()is a prelude function and a method onStandardOutputandStandardError(a no-op beyond flushing output, as error keeps no buffer); a read of standard input that must wait flushes output first. The classifiers are methods onrealinavin, written in Avin (self != self; comparison with the infinities;self - self == 0.0);real.NaN,real.PositiveInfinityandreal.NegativeInfinityalready existed, andrealis the only floating type. WHY: a drawing program must push a frame without a newline, and a prompt must be seen before the wait; the methods read aschar‘s do, where theavin.mathfunctions are not methods. ALTERNATIVES: aWriter.flushon the trait (every writer would need a meaning); flushing only onprint(defeats buffering);math.isNaN(x)functions (the spec keepsavin.mathfor elementary functions). Review with the user if aWriter-levelflushis wanted. -
Settled on the user’s delegation 2026-11-06 (branch
exit-hooks): Exit hooks areprocess.onExit(@sendable body: () -> unit) -> ExitHook, withcancel() -> bool, run newest first and once each (exit hooks). Why: a library that changes the world outside the program (tui’s raw mode and alternate screen) must put it back on every ending, and the language has nofinallyordefer; a hook per change, cancelled when the change is undone normally, is the smallest shape, and newest first undoes changes in the reverse of the order they were made. Alternatives: one global handler to set (libraries would overwrite each other); adeferconstruct (scoped to a frame, so it cannot run on a trap or anexitfrom another thread); oldest first. -
Settled on the user’s delegation 2026-11-06 (branch
exit-hooks): The thread that ends the program runs the hooks: the main thread whenmainreturns, the thread callingexit, the trapping thread after its report (an escalated actor failure and running out of memory included), a test’s process as a program. The other threads go on running meanwhile; one that traps or callsexitwaits for the end silently, the first ending being the program’s. So the body is@sendable. Why: a trap on another thread cannot hand work to the main thread, which may be blocked or be the one that trapped, and stopping every other thread first would stop the threads a hook needs (a future’s pool) or leave them stopped holding locks. Alternatives: always on the main thread (impossible when it is the one waiting or trapping); stopping the other threads first; hooks free to capture anything (a data race with the threads still running). Review with the user: whether a hook should rather be allowed to capture non-sendable state from the main thread for the common case. -
Settled on the user’s delegation 2026-11-06 (branch
exit-hooks): A hook that traps or callsexitnever goes on, and the hooks after it still run, on top of its stack rather than after unwinding it (the runtime’s frames hold counted values a jump past them would leak). The trap is reported asavin: trap in an exit hook:and the program then ends as a trap ends it, even wheremainreturned orexitwas called; anexitin a hook keeps the status of the ending that ran the hooks. A trap in a hook while a mutex is held stops the program at once, since a later hook may need what the lock guards. Why: one bad hook must not keep the others from putting their state back, and a failed cleanup must not end with a status that says success. Alternatives: a trap in a hook ends the program at once; anexitin a hook replaces the status (the last word wins, which a cleanup should not have). -
Settled on the user’s delegation 2026-11-06 (branch
exit-hooks): A hook registered while the hooks run runs too, at once after the one that registered it;cancel()answersfalsefor a hook that has run or begun. Why: the registry is a stack the runner pops, so a hook a cleanup registers is the newest. Alternative: ignore registrations once the program is ending (silently drops cleanup a hook asked for). -
Settled on the user’s delegation 2026-11-06 (branch
exit-hooks): No hook runs on a stack overflow or on an unwatched signal. A stack overflow is reported by a handler on its own small stack where no Avin code can run. A signal the program does not watch keeps its platform action; a program that wants its hooks onTerminate,InterruptorHangupwatches it and callsexit, as tui already watches them. Why: running hooks on an unwatched signal needs a watcher thread in every program with a hook, and a library watch of its own would change what the signal does for the program, whichavin.signalpromises it does not. Alternatives: the runtime watchesTerminate,InterruptandHangupwhenever a hook is registered and nothing else watches them, ending withexit(128 + sig)after the hooks; running hooks from the overflow handler on a fresh stack (the thread may have overflowed inside a lock). Review with the user: the signals, if a program wants cleanup on Ctrl-C without watching for it. -
Settled on the user’s delegation 2026-11-06 (branch
generic-joins): Two tuples join part by part (generics).(Dog, long)and(Cat, long)agree on(Animal, long)wherever two types are joined: the arguments of one type parameter, the branches of anif, the arms of amatch, the elements of a literal, and a tuple inside a covariant argument (Option,Vector,List). Each part joins as two types alone do, so a part of an invariant type (Array[Dog]besideArray[Cat]) or two different value types (longbesideint) still have no join, nor have tuples of different sizes. Why: the chapter already lists a tuple part among the places a value is read out, and two classes alone join; a tuple of them failing to was an omission in the checker’s join, which handled classes and generic types but not tuples. Alternatives: requiring the tuple type to be written (a contortion the class case does not need). Nothing here deserves a conversation. -
Settled on the user’s delegation 2026-11-06 (branch
generic-joins): A number literal among values that agree on one type takes the type the others decide (generics, collections). Among the elements of a collection literal, the keys or values of a map literal and the branches of anif, the values are checked in tiers, as a call’s arguments are: those holding no literal first, then values built around a literal (Some(2),(2, "b"),[2]), then expressions of literals alone (2,2 * 3,-5), then empty literals, each later tier given the shape of what the earlier agree on with its value types kept and its classes left open. So[long(1), 2],[2, long(1)]andif c then 2 else bigarelong, and[1.5, 2]isVector[real]. Amatcharm takes part only where it is an expression of literals alone, since an arm checked after the others would be checked outside its pattern’s scope, and a value built around a literal may name a pattern’s binding. Diagnostics for values with no common type still read in written order, at the later value. Why:types.mdalready says a literal takes its width from the other operand, and the literal chapter says elements agree as anif‘s branches do;[long(1), 2]being an error whilelong(1) + 2is not read as a gap to programs. Alternatives: only the collection literal (leavesifandmatchstricter than the literal that is said to agree as they do); leaving each literal an inference variable settled at its use (the alternative weighed for nested literals too, deferred for the same reason); deferring everymatcharm that holds a literal by re-entering its pattern’s scope (more machinery for a rare shape). Review with the user: whethermatcharms such asSome(2)besideSome(big)should also agree. -
Settled on the user’s delegation 2026-11-06 (branch
okor-command-message):Option.okOr/okOrElseandCommandError.message.Option[T]gainsokOr[E](error: E) -> Result[T, E]andokOrElse[E](f: () -> E), theResultcounterparts oftoRight;Result.okanderr()already existed.okOrtakes its argument by value andokOrElsea function called only forNone. WHY: the two names say which form evaluates; the by-name form already exists as a lambda call, and a by-nameokOrwould leaveokOrElseredundant. Alternatives: a by-nameokOronly (astoRightis; one method, but an argument with effects reads as eager and is not), ortoRight-style names (toOk). Review with the user ifokOr‘s eagerness should instead matchtoRight‘s.CommandError.message -> stringreadsexited with status N,killed by signal N (Name)(unknownfor a signalavin.signalhas no name for),timed out, and anIoerror’s ownIoError.message. WHY: one sentence per variant inIoError.message‘s lower-case style, the signal’s name beside its number asavin.signalnames them. Alternatives: the number alone;ExitStatus.messageas well (not added: nothing needs it yet). -
Settled on the user’s delegation 2026-11-06 (branch
sysl-098):Child.detach()(commands).detach() -> longlets go of every program of the command still running without stopping it (Sysl’sSpawned.detach) and answerspid(), the samelongtheChildalready answers it as; a sequence’s later part not yet started is never started, and the sequence’s own redirected files are closed, the running part holding its copies. AfterwardswaitFor,isAliveandkilltrap (a detachedChildis not waited for, asked after or stopped), whilepid,group,signal,signalGroupandresidentBytesanswer from the ids recorded at each start; a seconddetachanswers the pid again, and detaching a command already waited for lets go of nothing. Nothing reaps a detached program: one that ends while the program runs is a zombie until the program ends. WHY: once detached theChildcan no longer see the command end, so an answer fromwaitFororisAlivewould be a guess, and a trap is how the library treats a handle used against its state (aChildused from the wrong thread); keeping the id-based operations lets a program still stop what it started. ALTERNATIVES:waitForstill waiting by pid (reaping, which makes a detached command a waited one again and races a reaper the program may run itself);ErrfromwaitForandfalsefromisAlive(anisAliveoffalsewould be a lie about a running program); answeringintas Sysl does (theChildanswers every id as along); refusing to detach a pipeline or a sequence. Review with the user: whether a detached command should be reaped by the runtime so it leaves no zombie. -
Settled on the user’s delegation 2026-11-19 (branch
process-pipes): a started command’s standard streams as pipes (pipes to a started command).pipeInput(),pipeOutput()andpipeErrors()onCommandask for them, each replacing an earlier redirection of its stream as the other redirections do, andpipeOutput().errorsToOutput()merges standard error into the output’s pipe;Child.stdin(),stdout()andstderr()answer them, the same end every time, and trap for a stream not piped. The ends are new public classes,ChildInput: avin.net.StreamWriterandChildOutput: avin.net.StreamReader, withChildOutput.readAvailable(max)as standard input has it. Why: the halves of a split connection are exactly the shape (aReader/ByteWriterthat is also aReadiness/Writability, withreadLine,readAll,writeSome,setTimeoutandclose), so a protocol written against a connection’s halves (a language server’s client) runs over a child unchanged, andselectandSelectortake them with no new arm. Each end is non-blocking and waits as a socket does (runtime/avin/rt/pipes.sysl), parking a lightweight thread on the poller; a write to a reader that has gone answersConnectionReset(on macOS the end is markedF_SETNOSIGPIPE, since that system raises the write’s SIGPIPE on the whole process; elsewhere SIGPIPE is blocked on the writing thread for the write and taken back). The ends are made bysysl.process.pipe, closed on exec. Choices: onlystart()hands pipes over:run(),output(),lines()and a part of a pipeline or sequence asking for one trap, since nothing could ever hold the pipe; the pipes do not belong to theChild(Pipesis@keeps_owners), so handing theChildto a thread that waits for it leaves the pipes with the code using them;waitForandChild.close()leave the pipes alone (each end closes with its ownclose(), or when collected), because an end may belong to another thread at the time; the command’s time limit bounds every wait on its pipes, a wait past it answeringTimedOut, sowithTimeoutcannot be outwaited by a read nobody times; the pipes do not keep the command running. Alternatives weighed: the ends asio.Reader/io.ByteWriterclasses ofavin.processalone (noavin.netdependency, but every connection protocol would need an adapter); socket pairs in place of pipes (all of the socket code reused, but a child sees a socket where it expects a pipe);Option-answering or take-once accessors (takeStdout()), which make a loop ofchild.stdin().write(…)wrong; ends owned by theChildand handed over with it, which traps a program reading a child’s output while a thread waits for it;waitForclosing the input first, which reaches across threads;run()with a pipe meaning an empty input. Review with the user: whetherChild.close()should also close the pipes the closing code holds, and whether the ends should keep the command alive. -
Settled on the user’s delegation 2026-11-06 (branch
sysl-098):totalMemoryandresidentBytes(the environment and the platform).process.totalMemory() -> Result[long, IoError]andprocess.residentBytes(pid: long) -> Result[long, IoError]over Sysl’stotal_memoryandresident_bytes, theu64bound as along(machine memory and a process’s resident pages are far below 2^63), andChild.residentBytes()for the programpid()names. A process that is not there (Sysl’sNotFound, which from Sysl 0.9.9 it answers for a reaped child and an unused pid alike), a pid of zero or less and one past the largestintareErr(NotFound); Sysl’sNotPermittedisErr(PermissionDenied), which macOS answers for pid 1 and Linux does not (it reads any process’s size). AChildseen to have ended, or with no program started, isErr(NotFound)without asking. WHY: the pid is alongeverywhere else inavin.process(pid(),signal);NotFoundandPermissionDeniedare theIoErrorcases a program tells apart, where Sysl’sNotPermittedwould otherwise read asOther(text). ALTERNATIVES:pid: intas Sysl takes it;Option[long](loses why); passing Sysl’s “no such process” through asOther(...)assignaldoes. -
Settled on the user’s delegation 2026-11-06: A group of only ended, unreaped processes answers “No such process” (branch
group-signal-eperm; commands).signalGroupmaps the platform’s permission refusal toErr(Other("No such process")): on macOSkill(-pgid)answers EPERM while a group holds only zombies and ESRCH once they are reaped, so the same program saw either answer by the timing of the reaping. Every process in a group a command made belongs to the program’s user, so a refusal can only mean that. WHY: one answer for an empty group, however the reaping falls. Alternatives: leave the platform’s answer and have callers wait for reaping (no way to observe it, and the flake stays); report the permission error only for a group the program did not start (not reachable, sincesignalGrouponly names groups of its own commands). -
Settled on the user’s delegation 2026-11-06 (branch
parallel-codegen): A build compiles the program’s LLVM text as codegen units at once, one clang each, at most eight, and keeps each unit’s object in the toolchain’s cache by its text. A function only one function calls goes with its caller (kept local, so still inlined there: without this a hot single-caller function across a cut ran ~6% slower at-O2); other functions are placed by a hash of their name, globals with their first user, aliases with their global; a local crossing units is promoted to a hiddenavin.cgu:name; at-O2small functions (body cost at most 32) and short constants are copiedavailable_externallyinto the units that use them. Why: clang -O2 on one 34 MB module was ~10 s of a 15 s rebuild of tui’stopon one core of eighteen; the hash placement keeps an edit to one function inside one unit, so the cache recompiles one unit. Eight: on a machine of six performance and twelve efficiency cores more units land on the slow cores and repeat more declarations and copies (the same cap Sysl’s builds measured). Alternatives weighed: units balanced greedily by size (better balance, but every edit that shifts a size reshuffles the units and defeats the cache); copying small local functions as local copies (cheaper, but a function would have one address per unit); no copies at-O2(a call across units could never be inlined); no object cache (a one-line edit recompiles every unit); one unit per processor without a cap.AVIN_CODEGEN_UNITSoverrides the count. Review with the user only if-O2run-time performance across units ever shows up in a profile: the copy limit is the knob. -
Settled on the user’s delegation 2026-11-06 (branch
parallel-codegen): The cache of unit objects is trimmed to 1 GiB, oldest first, after a build that compiled a unit, sparing anything used in the last hour; a reused object’s time is refreshed. The test corpus links without keeping objects. Why: a build oftopkeeps ~8 objects of a few MB per level, so 1 GiB holds dozens of builds; the hour keeps a concurrent build’s objects from being evicted under it. Alternatives: a count of objects; no trimming. -
Settled on the user’s delegation 2026-11-06 (branch
process-exec):process.execand its environment (becoming another program).exec(program, args) -> Result[Nothing, IoError]over Sysl 0.9.9’ssysl.process.exec, inheriting the environment, and an overloadexec(program, args, environment: Map[string, string])giving exactly that environment, nothing inherited, a bare name looked for on itsPATH. Why: aResultwithNothingon itsOkside lets?pass the failure on and says in the type that success never comes back; a wholeMapmatches whatprocess.environment()answers, so adding to the program’s own isenvironment().updated(...), and a self-upgrading daemon wants the environment it was started with. Alternatives weighed: answering a bareIoErroras Sysl does (no?); aCommand.exec()carryingwithEnv/clearEnvedits (a command’s directory, time limit and redirections have no meaning for anexec, and would need refusing); a vector of environment edits. Standard output is flushed by the Sysl call (fflushof every stream, which is where Avin’s output is buffered). Amatchover the answer still needs anOk(_)arm, since exhaustiveness does not yet treat a variant holdingNothingas impossible. Review with the user whether such arms should be dropped from exhaustiveness. -
Settled on the user’s delegation 2026-11-06 (branch
process-exec):waitPidandtryWaitPidanswerErr(NotFound)for anything not there to wait for: a pid that is not this program’s child or was already reaped (Sysl’sOther(10),ECHILD), and a pid of zero or less or past the largest process id (Sysl’sOther(22)for the first, refused before the call for the second). Why: it matchesresidentBytes, where a process that is not there, a reaped child among them, and a pid of zero or less areNotFound, and gives a caller one case to match.waitPidis boundblocking, asChild.waitForis, and both answer the same mirroredExitStatus. Alternatives weighed:Otherwith a sentence (unmatchable by kind); a trap for a pid of zero or less (a pid read back from saved state is data, not a programming error). -
Settled on the user’s delegation 2026-11-07 (branch
fs-rename):fs.rename(from, to) -> Result[unit, IoError](system library) replaces what is atto, in one step, and does not refuse. A file replaces a file; a directory replaces an empty directory; a directory that holds entries isDirectoryNotEmpty; a file onto a directory isIsADirectory, a directory onto a fileNotADirectory. Renaming a path to itself succeeds and changes nothing. WHY: the call exists for the atomic write (writestate.json.new, rename it overstate.json), which is only atomic if a reader sees the old file or the new and the replacement never fails because the old one is there; replacing is also what the platform’s own rename does, so no extra check can race. ALTERNATIVES: refuse withAlreadyExistswhentoexists (a separate check-then-rename is racy, and the atomic write would need a remove first, losing atomicity); two functions,renameandrenameReplacing. Across file systems the call fails and moves nothing (Other), never copying. Review with the user if a refuse-by-defaultrenameis preferred. -
Settled on the user’s delegation 2026-11-07: A
Zoneholds its rules in Avin until Sysl’s own zone can be held (branchlocal-time). A zone is a final class of a name and its rules: one fixed offset, or the bytes of the host database’s file for it as an immutableVector[byte]. Each question (offsetAt,isDaylightSavingAt,abbreviationAt) passes the bytes to the runtime, which decodes them with Sysl 0.9.9’ssysl.time.tzifand answers. Why: that release’s decodedtzif.Zoneis a view of the bytes it was decoded from, so it cannot be held as a handle past the call that made it; the bytes can, and a zone so held is an immutable value any thread may share, as the chapter says, where a handle belongs to one thread. Decoding a table walks its header, short beside reading it. Alternatives weighed: a handle over the borrowed view (a dangling reference once the shim’s copy is freed); a runtime table of decoded zones under a lock, handed out by number (global state and a lock for what is a pure function of the bytes); waiting for Sysl 0.10.0’s owningZone(marshal needs the local time now). When Avin moves to Sysl 0.10.0,Zonebecomes a handle over its zone with no change to Avin’s API. Review with the user: the roadmap planned the handle from the start. -
Settled on the user’s delegation 2026-11-07: The local zone is the one
TZnames, else the one/etc/localtimeis, read from the database like any other (branchlocal-time).TZwith a leading:dropped is a zone’s name, aTZthat is a path is that file, named for what follows itszoneinfo/; withTZunset,/etc/localtime‘s bytes are the table and its link’s target afterzoneinfo/the name (localtimewhere it is a copy). An emptyTZ, one naming no zone, one that is not a zone’s name, and a file that does not decode giveutc. Why: one source for the offset, the abbreviation and daylight saving, and a local zone equal tozone(name)of its own name, solocalZone() == zone("America/New_York")?where that is the host’s zone. Alternatives weighed: the offset fromlocaltime_r(Sysl’slocal_offset) with the abbreviation from the table (two sources that could disagree, and a POSIX ruleTZsuch asEST5EDTwith no file would have an offset and no abbreviation); a zone namedlocal(never equal to the named zone it is). A POSIX rule string with no file of its name in the database is thereforeutc. -
Settled on the user’s delegation 2026-11-07: Pattern details the chapter left open (branch
local-time):||is a bar between the bars too (|a||b|writesa|b), as it is outside them, so any text can be quoted;DDDpads the day of the year to three digits, asDDpads the day of the month to two;YYis the last two digits of the year’s magnitude (01for year-1);YYYYoutside0to9999writes the year as the display does (+12345,-0001);zandzzof UTC are+00:00and+0000, neverZ, so a pattern writes one shape for every zone (a literalZis written as itself);f…ffffffcut the fraction rather than rounding, so a reading never rounds into the next second; and the whole pattern is read before anything is written, so a malformed pattern traps as malformed whatever value it is given. Alternatives weighed:DDDunpadded (a column of days of the year would not line up);Zfor UTC’sz(a pattern’s output would change shape with the zone). -
Settled on the user’s delegation 2026-11-07 (branch
stop-signals):avin.signalnamesStop,Continue,TerminalStopandChild. Each is anintnumbered by the runtime for the platform (avin.rt.job_signal, over Sysl’sSTOP,CONT,TSTPandCHLD, asUser1andUser2are overUSR1andUSR2), since all four differ between macOS and Linux.Stopcannot be watched:watch(Stop)isErr(Other("Invalid argument")), the refusalKillalready gets, because the platform lets nothing catch it.Continue,TerminalStopandChildcan be watched like any other signal; a watchedTerminalStopno longer stops the program, and a watchedChildis raised whenever a program the program started ends, is stopped or continues. A status a signal ended also names them (killed by signal 19 (Stop)), and now namesUser1andUser2, which it called “unknown”. Why: a supervisor pauses a job’s process group withStopandContinue, and needsChildto see an end that races a restart; anErr, not a trap, is the existing treatment of a signal that cannot be watched, and a refusal is a value the caller can act on. Alternatives weighed: a trap onwatch(Stop)(inconsistent withKill, and a platform-dependent number would make “this one traps” a hidden fact of the platform); leavingStopout of the library and sending a literal number (the number is not portable); spellingContinueasCont(the library spells every other name out). Review with the user: whetherTerminalStopshould be left unwatchable, as a program that traps Ctrl-Z rarely means to. -
Settled on the user’s delegation 2026-11-07 (branch
lambda-after-literal): A lambda’s result takes part in a call’s literal tiers (generics). A lambda whose parameter types are known is checked in the tier of the value it yields (the last item of its block; the lowest tier among anif‘s or amatch‘s branches), after the other arguments of that tier, rather than after every argument. Sopick(s -> s.toLongOption(), 0)forpick[T](read: (string) -> Option[T], absent: T)takesT = long, as passing a named function does, andpick(s -> s.toRealOption(), 0)takesreal; a lambda yieldingSome(1)or1takes the numbers the other arguments decide. A lambda that leaves its body byreturnor?, and amatchfunction, are still checked last, since such a body needs its result type known before it is checked. Why: the settled number-literal decision says a literal gives way to a type from a neighbour, and a lambda’s result is a neighbour; a lambda checked last let the0fixT = intfirst, so the lambda and a named function of the same type behaved differently (marshal met it). Alternatives: deferring the literal instead of advancing the lambda (the same order in effect, but it reaches only literals, not the lambda’s own literal result); checking a lambda with?against a result type known only in shape, deferred here and since built (next paragraph).Settled on the user’s delegation 2026-11-15 (branch
lambda-question-shape): a lambda using?orreturnchecks against a result known only in shape. Where the function type expected for a lambda yields anOption[T], or aResult[T, E]withEknown, andTis still to be inferred (wholly or in part), the lambda’s result is that shape:?passes aNone, or anErrconverted toEas in any function, and the body’s value solvesT, soinside(n -> Ok(half(n + 1)? + 1))forinside[T](f: (int) -> Result[T, string])takesT = int. AResultwhoseEis itself unknown, and any other shape, stay refused with “this lambda uses?, so its result type must be known where it is written”. WHY: the pg package needs it for everyc.transaction(tx -> { tx.execute(…)?; Ok(x) })andpool.usebody, where the transaction’s value type is the caller’s and the error type is the library’s; the error type is what?needs, and it is known. Only a lambda that exits by?orreturntakes the shape as its declared result; any other lambda still infers from the body against the shape as a hint, so nothing it accepted changes. ALTERNATIVES: inferringEfrom the first?too (makes a lambda’s error type depend on which failure is written first, and a later?of another error type then fails to convert rather than widen); making a?lambda take part in the literal tiers as well (it is still checked after the other arguments, sopick(s -> Some(s.toLongOption()? + 1), 0)still fixesT = intfrom the0and is refused: checking it earlier would refuse a?lambda whose result is a bareTthat only a later argument decides). Review with the user: whether a?lambda should also join the literal tiers when its expected result has the shape, which would make thepickexample along. -
Settled on the user’s delegation 2026-11-07 (branch
hash-digest):avin.crypto, digests oversysl.crypto. The module isavin.crypto; it hassha256,sha512,sha1andmd5(each taking aVector[byte]or astring, hashed as UTF-8, answering aVector[byte]),hmacSha256andhmacSha512,toHex, and incrementalSha256(),Sha512(),Sha1()andMd5()withupdateandfinish. WHY: marshal hand-wrote FNV-1a to key a build cache because the library had no digest, and Sysl already has SHA-2, SHA-1, MD5 and HMAC; a binding cannot disagree with Sysl.avin.cryptorather thanavin.hashbecause the module holds keyed digests, and “hash” in Avin already means the trait behindHashMap. A digest is aVector[byte], not a string, so it compares, keys and stores as bytes and hex is one call away. Details:finish()caches its digest and answers it again, andupdateafterfinishtraps (a Sysl hasher cannot be finished twice); the hashers are Avin classes over private handles because a handle has no constructor; the one-shot digests and HMACs go through smallavin.rtfunctions (runtime/avin/rt/digest.sysl) because Sysl’s one-shot functions answer a fixed array ([32]u8), which no binding result takes, and Sysl keeps its streaming HMAC private. ALTERNATIVES:avin.hash(above); digests as hexstring(loses the bytes); one-shots through the Sysl hasher handle only (cannot reach HMAC); making the boundary accept fixed[N]u8results (a compiler change for a handful of functions); an HMAC written in Avin over the hashers (a second implementation to keep correct); also offering SHA-224, SHA-384, HMAC-SHA-1 and HMAC-MD5 (Sysl has them, nothing asks) and a constant-timeverify(Sysl has one; add it when a program checks tags). Review with the user: whethersha1andmd5belong in the standard library at all, and whether the other SHA-2 widths andverifyshould be added now. -
A top-level name declared twice is reported with the first declaration’s place, and a clash between two files of a module suppresses every other diagnostic. Settled on the user’s delegation 2026-11-07. Each duplicate message ends
; first declared at FILE:LINE:COL. When the clash spans files, the program’s other errors are dropped before printing, because they are almost always cascades of the clash (twoFiltertypes in one module gave 48 conformance errors and no word of the clash, and the CLI shows five). A clash inside one file keeps its other errors, since existing reject cases mix a duplicate with unrelated errors and the duplicate is easy to see there. WHY: the clash is the cause and must be the error read first. ALTERNATIVES: suppressing for same-file clashes too (hides real unrelated errors in one file); ordering duplicates first without suppressing (the cascade still fills the five shown). Review with the user: whether same-file clashes should suppress the cascade too. -
File metadata in
avin.fsSettled on the user’s delegation 2026-11-07:metadata(path)answersResult[Metadata, IoError]withMetadata(size: long, modified: Instant, isDir: bool, isFile: bool), from onestat, so the fields describe one entry;size(path)andmodified(path)are shorthands for the two fields a program usually wants, andsetModified(path, instant)sets the modification time (and the access time with it). Every call follows symbolic links, asexists,isDirandisFiledo; a dangling link isNotFound.modifiedis anavin.time.Instant, the typenow()answers, so a program compares a file’s age withnow() - modified-style arithmetic and nothing else. Why: marshal’s retention kept.usedsidecar files because a file’s age and size could not be read; onestatis also one trip, and a value is not three answers about three possibly different files. Alternatives weighed: separatesize/modifiedonly (three trips for three facts, no directory answer); returning Sysl’s wholeMeta(owner, inode and permission bits are not what Avin programs ask yet, and they tie the type to POSIX); alinkMetadatathat does not follow (nothing needs it yet, andavin.fsoffers no way to make a link to ask about);setModifiedomitted (Sysl hasset_modified, so it costs a line, and it lets “last used” be recorded without writing). Times are microseconds, the library’s resolution. -
Permission bits in
avin.fsSettled on the user’s delegation 2026-11-23 (branchfs-permissions):Metadatagains a fifth field,permissions: int, the twelve low bits of the mode (the ninerwxwith setuid, setgid and sticky; never the file type), read by the same onestat;permissions(path)is its shorthand, assizeandmodifiedare;setPermissions(path, mode)sets exactlymode, following a link. The mode is anintwritten as an octal literal (0o600), which the lexer already reads. A mode outside0o0..0o7777is anErrof kindOthernaming it in octal (a mode outside 0o0 to 0o7777: 0o10000), raised before the path is touched, so the file keeps its mode. Setuid, setgid and sticky are accepted, sincepermissionsreports them and the two must round trip; where a platform refuses one (macOS: sticky on a plain file for a non-superuser) its error comes back as the platform’s. Why: marshal’s token file must be owner-only, and the bits belong with the other facts onestatgives. Alternatives weighed: a separatePermissionstype withownerRead-style accessors (more surface than one octal number, which is how every reader already thinks of a mode; can come later over the same int); masking an out-of-range mode silently to0o7777, as Sysl’sset_permissionsdoes (a type bit passed by mistake,0o100644from a rawst_mode, would succeed quietly); trapping instead ofErr(a mode read from a config file is input, not a program bug;File.seek‘s negative offset is the same shape and answersErr). Creating a file with a mode from the start (no moment with wider bits) is not in this entry: Sysl 0.13.2 exposes no create-with-mode,fchmodor umask call. -
isFilemeans a regular file Settled on the user’s delegation 2026-11-23 (branchfs-metadata):fs.isFile(path)andMetadata.isFileare true for a regular file alone; a FIFO, a socket and a character or block device now answerfalse, where beforeisFilewas “exists and is not a directory”. Why: every caller in the library, marshal and fettle asksisFilebefore reading, running or sizing a file, and a FIFO there blocks the read and a socket fails it; theevictOlderThanexample in the chapter would have removed another program’s socket. Alternatives weighed: keeping “not a directory” and addingisRegular(the common name would keep answering the question no caller means). Review with the user: it changes behaviour, though no test, example or caller found relied on the old meaning. -
Complete file metadata in
avin.fsSettled on the user’s delegation 2026-11-23 (branchfs-metadata):Metadatagainskind: FileKind,accessed,changed(bothInstant),owner,group,links,inodeanddevice(alllong), after its five existing fields, and anisLinkmember;linkMetadata(path)reads a link itself;exists(path, followLinks = true)asks about a dangling link withfollowLinks = false;isSameFile(a, b) -> Result[bool, IoError]compares inode and device;isReadable/isWritableask the platform’saccess; andavin.processgainsuserId(),groupId()anduserName(id).FileKindisRegular | Directory | Symlink | Fifo | Socket | CharDevice | BlockDevice | UnknownKind(bits), named from the type bits Sysl’sMeta.kindreports (itsSpecial(bits)split into the four POSIX kinds). Why: walking safely, de-duplicating and copying with attributes need the kind, identity and owner of an entry, and they come from the onestatalready made. Choices: ids arelong, since a user id is unsigned 32-bit and macOS’snobodyis4294967294; inode and device arelongwrapped from 64 bits, compared, never done arithmetic on.Regularrather thanFile:Fileis the open-file class of the same module, and a variant is a module-level name.isSameFileis aResult, notfalsefor a missing path, since “no such file” is not “a different file”.existstakes a named flag rather than a second name (existsNoFollow), as the copy options will.isReadableanswers for the user who started the program (access(2)‘s real ids), and the superuser istruewhatever the bits. Owner names are user names only, inavin.process: Sysl 0.13.2 hasuser_nameand no group-name lookup, sogroupNameis left out until it does. Alternatives weighed: a separateLinkMetadatatype (the fields are the same); aPermissions-style object for ids (one number is what every reader thinks in);accessedleft out because some file systems do not record reads (it is still right aftersetModified, and the chapter says which do not). -
Settled on the user’s delegation 2026-11-08 (branch
runner-streaming):avin testpushes its report out as it goes, and on SIGTERM or SIGINT writes out what it holds and names the work in progress. The report text of a run is unchanged. The report is pushed to its reader when a test finishes and at least half a second has passed since the last push (the first finish always pushes), and at the end of the run, so a log read while the run is alive shows every test but the last half second’s, and speed is unchanged. On SIGTERM or SIGINT the runner pushes the report at once, then writesavin test: interrupted by SIGTERM; in progress:(orSIGINT) and one line for each piece of work still running, in the formrun <file> <test> <seconds>sfor a test andcompile <program> <seconds>sfor the build of the program, stops the test processes it started and exits with 143 (TERM) or 130 (INT), within about 20 ms of the signal. A watcher thread reads the signals, so a build blocked in a tool, or a compiler pass that is busy, cannot keep the lines from being written. The new optionavin test --prefixputs the file’s path and a colon before every result line (a.avin: ok passes 3ms), for runs whose output is interleaved with other runs’ in one log; headings and the summary are not prefixed. Why: a job stopped at its deadline left a zero-byte log because the report sat in a buffer until the run ended, and a hung build named nothing. Alternatives weighed: flushing after every line (cost: a write for every line of a many-test run), a prefix always on (changes every existing report), a prefix on only when output is not a terminal (the same program would write different text by where it was sent), and polling the signal flag between tests (a blocked test or build would never reach the poll). Review with the user: the option’s name--prefix, and the exit codes 143 and 130 (the shell’s 128 + signal convention). -
Settled on the user’s delegation 2026-11-09 (branch
with-update):withis refused on a data type with several variants, and a path through a field of such a type (Optionamong them) is refused too. Why: variants are constructors, not types, so no static type says which variant a value is and which fields it has; the language already refusess.radiuson aShapefor the same reason, and amatcharm makes the new variant directly (Circle(r) -> Circle(r + 1)). Alternatives weighed: accepting it where every variant has every named field, with the same type, and choosing the variant at run time (a hiddenmatch), which makes the form’s cost and its errors depend on edits to other variants; and trapping on a variant without the field, which turns a compile-time error into a run-time one. Review with the user: whether the every-variant-has-it form is wanted for enums whose variants share a common header. -
Settled on the user’s delegation 2026-11-09 (branch
with-update): awithkeeps the base’s type arguments:Box[int] with { v = "s" }is a type error, not aBox[string]. Why: the result is then always the base’s type, as the desugaring to a copy says, the value of each change is read against a known field type (so literals andNonetake it), and a field the change does not name, which may hold aT, never has to be re-checked at a new type. Alternative weighed: re-inferring the type arguments from the changed fields and the kept ones, which is what a call of the variant would do; it is left for an explicit construction,Box("s", b.label). -
Settled on the user’s delegation 2026-11-09 (branch
with-update):withis read as the update only when the brace follows it on the same line, as a postfix tail binding tighter than every prefix and infix operator; before anything else it is an ordinary name, soa with bstays the infix call of a methodwith. Why: keywords are contextual, andIsolated.withand the library’sshared.with(f)keep their names. The cost: an infix call of a methodwithwhose argument is a set or map literal must be writtena.with({…}). Alternative weighed: makingwitha reserved word, which would rename those methods. -
Settled on the user’s delegation 2026-11-09 (branch
with-update): a misspelt field is reported with the nearest field when it is at most two single-byte edits away and fewer edits than the name’s length (nmaesuggestsname; a one-letter name suggests nothing). Alternative weighed: listing every field of the type, which is long for wide types. -
Settled by the user 2026-11-09: placeholder lambdas
_ + 1(placeholder lambdas; branchplaceholder-lambdas). Each_in a call’s argument is a parameter of its own, in the order written, and the smallest argument holding it is the lambda’s body:xs.map(_ + 1),xs.map(_.name),xs.reduce(_ + _),xs.map(f(_, 2)). The right side of avalwith a declared function type takes one too. Parameter types come from the expected type, as for any lambda. Why: the user’s rule that Avin adopts the conveniences that add no complexity; the short form reads as what it does and is the usual one for a one-step function. -
Settled on the user’s delegation 2026-11-09 (branch
placeholder-lambdas): a_that is a whole argument belongs to the argument around its call, soxs.map(f(_, 2))isxs.map(x -> f(x, 2))andf(_)is never the identity lambdaf(x -> x). Where a call with such a_is itself no argument and no declared value’s right side (f(_, 2)as a statement), it is an error asking for the lambda to be written out. Why: the identity is rarely whatf(_)means, andx -> xis short; reading the whole call as the lambda is what makes partial application,f(_, 2), work. Alternative weighed: the identity lambda, which makesf(_, 2)a call offwith a function. -
Settled on the user’s delegation 2026-11-09 (branch
placeholder-lambdas):xs.map(f(_))is an error saying to passf: a placeholder lambda that only calls a function named in lowercase with all its parameters in order (f(_),add(_, _)) is that function, and functions are already values. A name starting in uppercase (Some(_),Point(_, 0)) is taken for a constructor and makes the lambda. Why: one spelling for one meaning, and the error teaches that a function is passed by name. Alternatives weighed: accepting it asx -> f(x)(harmless, but two spellings), and deciding by what the name resolves to rather than its case, which needs the parser to know the checker’s answer; the case test follows the settled naming rule. Review with the user: whether the redundant form should simply be allowed. -
Settled on the user’s delegation 2026-11-09 (branch
placeholder-lambdas): where a placeholder is searched for. Through operators of every precedence, member access and method calls, tuple parts,is, ranges,?,with‘s base, a call’s callee and a call’s arguments that are_alone; never into a lambda, a block,if,match, a collection literal, an interpolation, an assignment or another call’s other arguments. A_in those is an error, not a lambda around the nearer construct. Why: the set is the expressions that read as one step on one value, and a_inside a nested lambda or a branch would make the reader search for which lambda it belongs to. Alternatives weighed: searching everything to the argument (makesxs.map(n -> n + _)a lambda returning a lambda) and searching operators only (rejects(_, 0)and_ is Some(_)). -
Settled on the user’s delegation 2026-11-09 (branch
placeholder-lambdas): a declared value takes a placeholder lambda only by its written type:val f: (int) -> int = _ + 1and any declared type other than a tuple; an undeclaredval f = _ + 1is an error, as are a function’s body,returnand an assignment’s right side, whose expected type the parser does not see. Why: the brief’s rule, kept syntactic so the lambda’s extent never depends on type inference. Alternative weighed: any expression with an expected function type, which makes the extent of a lambda depend on checking. (Amended 2026-11-19, branchunderscore-fn-expected: a function’s body with a written result type is a place too, since its type is written as a declared value’s is; see the entries below.) -
Settled on the user’s delegation 2026-11-19 (branch
underscore-fn-expected): a branch is a place of its own. Where anif, amatchor a block stands where a placeholder lambda may (a call’s argument, a declared value, a function’s body with a declared result), each branch of theif, each arm of thematchand the block’s last line is such a place in turn, recursively, with a call argument’s rules:val key: (Request) -> string = by match "method" -> _.method …andxs.map(if up then _ + 1 else _ - 1). The condition, subject, guards and a block’s earlier lines keep their own_, and aniformatchanywhere else gives no branch a place, soval f = if c then _ + 1 else 0keeps its error. Why: a choice among functions is common (ported command-line programs met it at once), each branch’s value is the function expected, and the rule stays syntactic, so a lambda’s extent still never depends on checking. Alternatives weighed: searching the wholeif/matchfor one lambda around it (makesif _ > 0 then …a lambda of the condition, a different meaning per position), and deciding by the expected type the checker finds (any position, but extent then depends on inference). Review with the user: it widens the 2026-11-09 rule that anifand amatchkeep their own_. -
Settled on the user’s delegation 2026-11-19 (branch
underscore-fn-expected): a function’s body with a declared result type, and each of its clauses’ bodies, is a placeholder’s place, by the same rule as a declared value: any written result but a tuple, so a type alias of a function type works,adder(n: int) -> (int) -> int = _ + n. A function with no declared result is not one, andreturn‘s value stays none (the parser does not carry the result type to it). Why: the result type is written beside the body as a value’s type is beside its value. Alternatives weighed: only a result written as a function type (excludes aliases, unlike values), and leaving bodies out as before (the 2026-11-09 reason, that the parser does not see the type, holds forreturnbut not for a body whose type is written above it). -
Settled on the user’s delegation 2026-11-19 (branch
underscore-fn-expected): a placeholder lambda where no function is expected is reported once, as “cannot infer the type of this_“, and is then of no type, soval n: int = _ + 1andcount() -> int = if c then _ + 1 else 0no longer add “expected int, found () -> “ or “the branches agree on no type”. Why: the second message only repeats the first in worse words. Alternative weighed: keeping the function of errors, which is what a written lambda’s unknown parameter still gives. -
Settled on the user’s delegation 2026-11-09 (branch
type-aliases): type aliases are transparent,type Name[T] = Body(type): each use is the body with the type arguments substituted, and the checker keeps no trace of the alias, so diagnostics name the expansion. Why: an alias is shorthand for a long type, and a type a reader can see through needs no conversion and no new rules for equality, overloading or patterns. Alternatives weighed: a nominal alias (a new type, asdatamakes), which would need conversions everywhere and duplicates what a one-variant data type already does; remembering the alias for diagnostics, which needs an alias-carrying type in every type the checker builds and is left as a later improvement. -
Settled on the user’s delegation 2026-11-09 (branch
type-aliases):typeis a declaration word only before a name, and elsewhere an ordinary name, asactor,machine,lazyandwithare. Why: no Avin code in the library or the tests names anythingtype, but a field calledtypeis common in data that mirrors JSON or C, and keywords are contextual where they can be. Alternative weighed: a reserved word, which would forbid those names for no gain in parsing. -
Settled on the user’s delegation 2026-11-09 (branch
type-aliases): an alias’s type parameters take no variance, no bounds and no lower bound; the types its body names hold its type arguments to their own bounds at each use. Why: the alias is its expansion, so its uses are held exactly as the expansion written out would be, and a bound on the alias would only repeat the body’s (or wrongly differ from it). Alternatives weighed: bounds on alias parameters checked against the body, as a data type’s are, which adds a second statement of the same constraint; no check at all until the expansion is used as a value, which would acceptSorted[Opaque]in a signature. -
Settled on the user’s delegation 2026-11-09 (branch
type-aliases): an alias whose body does not use one of its type parameters is refused. Why:A[int]andA[string]would be one type, which reads as a distinction the program does not make. Alternative weighed: allowing it as a phantom parameter, which a transparent alias cannot give any meaning. Review with the user: a phantom-type idiom would needdatainstead. -
Settled on the user’s delegation 2026-11-09 (branch
type-aliases): an alias names only a type: it is not a value, a constructor, a pattern, an impl’s target or a parent in a class’s list, each refused with a message naming the expansion, and the name that makes and matches its values where there is one. Why: one meaning for an alias’s name keeps a call and a pattern reading as what they make and match, and the expansion may be a tuple or a function type that has no constructor at all. An alias of a function type in a class’s parent list is refused with the rest, though the function type itself may be written there. Alternatives weighed: allowing an alias of a data type or a class as its constructor and in patterns (P(1, 2)), which makes an alias’s use depend on what it expands to; allowingimpl Alias, which would add methods to a type under a name that does not say which. Review with the user: aliases of traits in a parent list may be wanted later. -
Settled on the user’s delegation 2026-11-09 (branch
type-aliases): an alias’s name may be shared with a function or a module value, but not with any other type of its module (data type, class, object, alias), a built-in type orSelf. Why: an alias lives only where types are written, so a function of its name is never ambiguous, while two types of one name would be. Alternative weighed: refusing every clash, as a class’s name clashes with a function’s because the class’s name is also its constructor, which an alias is not. -
Settled on the user’s delegation 2026-11-09 (branch
derives-enumerable):Enumerableis a core library trait derived through an ordinary template (library/avin/enumerable.avin), its membersstatic values() -> Vector[Self],ordinal() -> int,name() -> stringandstatic valueOf(name: string) -> Option[Self]; the compiler’s only part is who may derive it. Why: the template mechanism already gives every member (T.shape(),T.variantOf,T.build), so nothing new enters the compiler but the refusal, and the trait can be a bound (E: Enumerable) in generic code. Alternatives weighed: members the compiler writes out per type (a constant vector made once, fastervalues(), but a second derivation path beside the templates); anenumkeyword (new syntax for what a data type already is). -
Settled on the user’s delegation 2026-11-09 (branch
derives-enumerable):values()is aVector, made anew at each call. Why:Vectoris the library’s default sequence, what a literal[a, b]makes; a template has no per-type storage to keep one in, and the vector is immutable, so a fresh one is indistinguishable from a kept one except in cost (O(variants) per call). Alternatives weighed:Array(mutable, so it would have to be copied anyway);List; an iterator (cannot be indexed byordinal()). Review with the user ifvalues()turns up in a hot loop: a compiler-kept constant would make it free. -
Settled on the user’s delegation 2026-11-09 (branch
derives-enumerable):name()is part ofEnumerable, separate fromDisplay. Why:Displaycan be replaced by an impl, so it cannot be the inverse ofvalueOf;name()always is,T.valueOf(x.name()) == Some(x). Alternatives weighed: reusingtoString()/Display(breaks the round trip onceDisplayis customised); astatic names()(redundant withvalues().map(v -> v.name())). A type’s own method namednamethen clashes, reported as two methods of one name; review with the user if that proves common. -
Settled on the user’s delegation 2026-11-09 (branch
derives-enumerable):valueOfmatches the declared name exactly, byte for byte, answeringOption. Why: exact is predictable and cheap, and a program wanting another rule (case-insensitive, trimmed) writes it overvalues()andname(). Alternatives weighed: a trappingvalueOf(the library answers input that may be wrong withOption, astoIntOptiondoes); case-insensitive matching (ambiguous where two variants differ only in case). -
Settled on the user’s delegation 2026-11-09 (branch
derives-enumerable): a generic data type cannot deriveEnumerable, even when every variant has no fields (data Tag[A]withX | Y). Why: a derived impl of a generic type bounds each parameter by the trait (impl[A: Enumerable]), which means nothing for a phantom parameter, andTag.values()would need a type argument nobody can infer. A parameterless enumeration is what such code wants. Alternative weighed: allowing it with unbounded parameters,Tag[int].values(), a special case in how templates are applied. -
Settled on the user’s delegation 2026-11-09 (branch
derives-enumerable): only data types derive it; a class (an object cannot writederives) is refused even without constructor parameters. Why: a class instance has identity, sovalues()would make a new instance per call, unequal to the last. Alternative weighed: allowing a class of no parameters as an enumeration of one.
Exports between modules (branch export-reexports; modules)
- Settled on the user’s delegation 2026-11-09:
exportis written exactly asimportis:export a.b.X,export a.b.{X, y as z}, renaming withas, one top-level line each, at the top of any file of the module. Why: one syntax to learn, and every form an import has means the same thing in an export. Alternatives weighed: anexportmodifier on animportline (export import a.b.X), which ties presenting a name to bringing it into one file; a list in the package manifest, far from the code it shapes. - Settled on the user’s delegation 2026-11-09: an exported name is a name of the module, seen by every file of the exporting module
without an import, and found after the module’s own declarations and before the file’s imports.
Why: a module’s files are one namespace, and an export adds to that namespace exactly as a
declaration would; a module presenting
Pointand writingcentre(p: Point)beside it should not have to import what it already offers. Alternatives weighed: an export visible only to other modules, so the exporting file also writes the matching import (two lines per name, and a file of the module that forgets the import sees a name its importers see but it does not); an export visible in its own file only, as an import is (breaks “a module’s files are one namespace”). - Settled on the user’s delegation 2026-11-09: no wildcard export, as there is no wildcard import. Why: a module’s surface stays
readable from its export lines, and a declaration added to an internal module never silently
joins the public surface. Alternative weighed:
export a.b.*, convenient for a facade over one module; revisit with wildcard imports if those are ever added. - Settled on the user’s delegation 2026-11-09: an export names a public declaration of another module, directly or through that
module’s export; private, unknown, whole-module, own-module and root-module exports and a
private exportare errors. Why: an export presents a declaration, never widens one, and the root module has no name to be imported by. A whole module is not a declaration:export a.bwould make a module a member of another, which modules are not. Alternatives weighed: exporting a whole module as a nested name (shapes.geometryreachable asfacade.geometry), which needs module members and is left for later; letting an export make a private declaration public, which would makeprivatemeaningless to the module that wrote it. - Settled on the user’s delegation 2026-11-09: exports chain, and two modules may export each other’s declarations; exports that lead round without reaching a declaration are an error at each export of the cycle. Exports are resolved from the source before anything is declared, following each chain with the names it has passed, so a cycle stops rather than loops. A link that is wrong (a private or unknown target) is reported where it is written, and the exports chained after it are not reported again; an import through such a chain reports the name as private to, or missing from, the module it names.
- Settled on the user’s delegation 2026-11-09: an exported name clashes as a declaration does, but two paths to one declaration never clash. An export clashes with a declaration of its module, with another export of the name reaching a different declaration, with an import of a different declaration in a file of the module, and with a module imported under that name. A module exporting a name and importing the same declaration, exporting it from two files, and a file importing it both directly and through an export are all accepted. Why: the error exists to stop one name meaning two things; when both mean one declaration nothing is ambiguous. Alternative weighed: refusing every duplicate, which makes a module that both uses and presents a declaration choose between an import and an export for no reason.
- Settled on the user’s delegation 2026-11-09: every kind of top-level declaration can be exported: data types, aliases (generic
ones too), classes with their companion objects, objects, traits, machines (with
Door.State), functions (all public overloads of the name, never a private one), module-levelval,varandlazy val, and variants. A type’s variants are not exported with it: each is exported by its own name, as each is imported by its own, andColor.Redreaches one through an exported type either way. Why: an export is a name for a declaration, and every name an import can bring in is one an export can present; variants follow imports so the two never differ. Alternative weighed: exporting a data type’s variants with it, which an import does not do either. - Settled on the user’s delegation 2026-11-09: a module that exports a declaration of another presents that module’s extensions:
the exporting module’s own files, and every file importing it whole or any name of it, see the
methods the other module’s extensions add; a file importing a declaration through an export sees
its declaring module’s extensions as a direct import would. Why: “importing a module or any of
its declarations brings in its extensions” should not depend on which path reached the
declaration, and a facade over a package should carry the package’s extensions with it. Only
modules whose declarations are exported are presented, not modules the exporter merely imports.
Alternatives weighed: extensions reached only by importing their module directly (a facade could
not offer a package’s extension methods at all); an explicit
exportof an extension (an impl has no name to export). Review with the user: this widens which extensions a file sees. - Settled on the user’s delegation 2026-11-09:
exportis a contextual word, meaning an export only at the start of a top-level line before a name, and an ordinary name everywhere else (a functionexport(…), a field, a parameter, a local). Why: astypeis; nothing in the library or tests names anythingexporttoday, but the word is a natural method name (report.export()), and keeping it free costs one token of lookahead. Alternative weighed: a reserved keyword, simpler to lex but taking a useful name from every program. - Settled on the user’s delegation 2026-11-09: a diagnostic and the language server name the declaration an export reaches: an
import clash reports
already imported, from \inner.Widget`, the declaring module's path, and go-to-definition on an exported name (at the export line or any import of it) goes to the declaration itself. Completion afterm.` does not yet list a module’s exports (see Open).
Member exports (branch member-export; exporting members)
-
Settled on the user’s delegation 2026-11-19:
export f.min a type’s body is written as a module export is, one member, a{…}group,asrenaming, with operators by their spelling (export n.+), in the body of a class or an object, or in a plainimplof a data type of the impl’s own module (a data type has no body of its own). Why: one form for presenting something as one’s own, at the module and at the type. Alternatives weighed: a modifier on the field (delegate val items, all or nothing); generated wrapper methods the program writes itself (what the feature exists to save). -
Settled on the user’s delegation 2026-11-19:
export f.*presents every public member of whatfholds that the type does not have itself, unlike module exports, which have no wildcard. Why: the usual forwarding is a wrapper over one value’s whole surface, with a few members of its own replacing the wrapped one’s; listing every member defeats it. The module rule was about a declaration added to an internal module joining a public surface unseen; here the wrapped type is named in the field’s declared type, so what joins is visible there. Spelled*, not_, since_is a placeholder lambda in an expression and a hole in a type. Alternatives weighed: no wildcard, as for modules;_. Review with the user: the one place the two export forms differ. -
Settled on the user’s delegation 2026-11-19: a use is the use of
x.f.m, checked as that code, a fallback of the checker’s member lookup after the type’s own members, its superclasses’, its traits’ and its impls’: calls with every overload, defaults, named and repeated arguments and type arguments, reads, assignments of avarfield (x.m = v,+=,++), method values bound tox.fas read then, infix calls and operators (a + b, a lonea < b). Why: forwarding then means exactly what the longer code means, with its diagnostics, and needs no copy of a member’s signature to drift from it. Alternatives weighed: a wrapper method per overload, generated into the type (copies defaults, repeated and by-name parameters and type parameters of each member, and reports mistakes against the copy). -
Settled on the user’s delegation 2026-11-19:
fis a field (own, or a public inherited one) or a method of no parameter list, with its type declared, read again at every use. Avarfield reassigned between calls sends each to the value it then holds; a methodfruns at each use. Why: the export is part of the type’s surface, which other declarations (trait conformance, completion) need before any body is checked; a class parameter’s type is always written, so the common case costs nothing. Alternatives weighed: inferring an undeclared field’s type by checking the class body first, as a field read does (makes a declaration depend on a body); readingfonce at construction (avarfield’s export would go stale). -
Settled on the user’s delegation 2026-11-19: an export presents public members only: never a private one, by name or by
*, never a static one, neverequalsorhash(every value has its own); a member the field’s type exports in turn counts, so exports chain. Exports by name that lead round without reaching a member are an error at each export of the round, and wildcards that lead round present nothing (each search stops at a depth bounded by the program’s types). -
Settled on the user’s delegation 2026-11-19: the type’s own members win; an export by name of a member the type has is an error. A wildcard silently leaves the type’s own members (and its superclasses’, traits’ and impls’) to them, the usual way to replace a few of a wrapped value’s members. An export by name of a member the type declares, a field of its own or inherited, or a superclass’s method is an error, since naming a member and declaring it says two things; so are two exports by name of one name (naming both), and a subclass member named like an export its superclass makes by name (a use through the superclass would reach the export and one through the subclass the member, with no override between them). An export by name comes before a wildcard, and two wildcards both reaching a name make a use of it an error naming both. Alternatives weighed: the type’s own member silently winning over an export by name too (hides a mistake); an export by name winning over the type’s own member (makes the member dead code). Review with the user: the conflict rule.
-
Settled on the user’s delegation 2026-11-19: a public export by name of a class implements the trait’s methods of its name that the class does not declare: the class gets a method with the trait’s signature whose body is
self.f.m(params), standing as anoverridewould (it replaces a default too), so a call through the trait reaches the member; every overload of the trait’s name is implemented. A wildcard implements nothing, a private export of a trait method’s name is an error, a trait method with type parameters of its own is reported at the export, and a data type’s export implements nothing (its trait impls write their methods). A member that cannot be called with the trait method’s parameters, or yields another type, is one error at the export naming the export, the trait’s method, both signatures and the mismatch, never the diagnostics of the method written for it. Why: delegation-based conformance is most of what forwarding is for; requiring the name keeps a class’s conformance readable from its declaration, and keeps it from depending on what a wrapped type happens to have. Alternatives weighed: forwards never counting toward a trait (every conformance written out by hand); a wildcard counting too (a trait met by a member the class never names). Review with the user: trait satisfaction, its restriction to exports by name and to classes, and methods with type parameters of their own. -
Settled on the user’s delegation 2026-11-19: an export is reached through a value,
x.mandself.m, never by a bareminside the type nor byType.m. Why: a wildcard adding bare names to the type’s code would hide top-level declarations whenever the wrapped type grows a member; inside the type the field itself is in scope. Alternative weighed: bare names reaching exports as members do. -
Settled on the user’s delegation 2026-11-19:
private exportpresents the members to the type’s own code (its class and companion, or a data type’s impls), as a private method is. -
Settled on the user’s delegation 2026-11-19: the editor follows an export: completion after a dot offers the members a value’s exports present, under the names presented, and go-to-definition (and hover) on a use, an alias or the export line reaches the member’s declaration, the field read included.
-
Settled on the user’s delegation 2026-11-09 (built on branch
regex-budget, formarshal grep):avin.regex‘s checked searches. A spent step budget becomes a failure the caller can handle, answering the review question left on the settled limits on matching:- A checked family beside the plain API:
tryMatches,tryFindFirstIn,tryFindFirstMatchIn,tryFindPrefixOf,tryFindPrefixMatchOf,tryFindAllIn,tryFindAllMatchIn,tryReplaceAllIn(both forms),tryReplaceFirstIn,tryReplaceSomeIn,trySplitandPattern.trySplit, eachResult[T, MatchError]withTwhat the plain search answers. Why: a pattern written in the program that backtracks too far is a defect the trap explains, and everyfindFirstInstays a plainOption; a program searching outside text or patterns (a grep) needs to go on, and says so by its choice of method. It mirrorsRegex(p)besideRegex.compile(p)andUrl(text)besideUrl.parse. Alternatives: every search answering aResult(breaking, and makes every search fallible for what is almost always a defect); a regex-level mode (checked()) changing what the plain methods do on overflow (the result type cannot change with it, so it would need a sentinel); anerror()query on the iterator after it stops (easy to forget, so a spent budget reads as “no more matches”). - The gathered forms of every-match searches:
tryFindAllInanswers aVector, not an iterator, and the error discards the matches found before it; a replacer has been called for those by then. Why: an iterator ofResults, or one whose end might be an error, makes the common loop longer and is easy to read wrongly. Alternatives: anIterator[Result[Match, MatchError]]; giving the matches found so far with the error. MatchError(pattern, inputLength, budget), a plaindatatype withmessage()andDisplay, asPatternErroris;inputLengthcounts characters. Alternatives: aRegexErrorwith variants for both kinds of failure (compilewould change type, breaking); a bare message string.- The plain searches still trap, the message now naming the budget and the checked
alternative:
… past its budget of N steps; make a repetition possessive or atomic, or search with atrymethod to handle it. The budget stays per regex (withStepLimit), its default unchanged. Alternatives: a per-call limit argument on thetrymethods (doubles every signature;withStepLimitis cheap to call per search). - The matcher learns of a spent budget by a flag every step checks, so a spent budget ends the whole search through every nested part; a lookaround’s or atomic group’s body answering no for it is never taken as the body failing.
- A checked family beside the plain API:
-
Settled on the user’s delegation 2026-11-19 (built on branch
regex-sendable, a gap the concurrent-program ports met): a compiledRegex, itsPatternand aMatchare sendable, and each class declares: Sendable, so a change that makes one hold something mutable fails to compile in the library rather than in a program. AMatchIteratorstays not sendable: it is a search in progress. How: a compiled program’s operations, a literal’s characters and a branch’s alternatives areArraySeqs, filled once at compile time; a character class’s test is a@sendable (int) -> bool, so every closure that builds one is checked to capture only sendable values (a class’s table of the first 256 characters is copied into anArraySeq); and a class’s answers for the characters below 128, an array of 128bools, are twolongs of bits, which is no slower and holds nothing mutable. Each search already kept its own state (the engine’s groups, locals and backtracking stack), so no search allocates more than before. AMatchholds its group offsets asArraySeqs, which costs one copy of two small arrays perMatchmade;splitno longer makes aMatchper piece at all. Why: a pattern compiled once at module level and used from every worker is the ordinary way to write a concurrent scanner, crawler or server, and an immutable value that cannot be shared reads as a defect. Alternatives: compiling a regex per thread (what the port had to do; wasteful and easy to miss); a@sendablefield marker trusting the library (no check would keep it true); making the core library’s frozen array type reachable fromavin.regex(saves one load per operation dispatched but widens what the core module shares;ArraySeqis the public form of the same thing). Review with the user: whether the one extra load per dispatched operation throughArraySeqis worth a library-internal way to name a frozen array outside the core module. -
Settled on the user’s delegation 2026-11-09: Union types: the rules beyond the user’s five points (branch
unions-design; union types).- Precedence:
|binds tighter than->and looser than everything else in a type, so(A) -> B | Creturns a union and a union of functions parenthesizes each. Why: a function returning one of several results is far more common than a union with a function member, and->is already the loosest type operator. Alternatives:|looser than->(makes the common case need parentheses); refusing the unparenthesized form (noisy). - A union in a type pattern is parenthesized,
x: (int | string) ->; a|in a pattern is always an alternative, andx: int | stringis reported with the parenthesized form. Why: it keeps one meaning for|in patterns, as function types already need parentheses there. Alternatives: parsing a type after:greedily (makes_: A | _: Bmean something else). - Normal form: flatten, order irrelevant, a member that converts to another member (by subtyping
or boxing into a trait or
Any) absorbed,Nothingabsorbed, one member is that member. Written by hand, a duplicate, absorbed orNothingmember is an error naming the type to write; arising through an alias or type argument it is absorbed silently. Why:T | intatT = intandT | AnimalatT = Dogmust compile, whileDog | Animalwritten out is almost certainly a mistake. Absorbing by conversion rather than subtyping alone keeps every injection unambiguous (int | Displaywould otherwise leave aninttwo homes). Alternatives: keep subsumed members distinct (two homes for one value, an ambiguity on every injection); refuse at instantiation too (breaks generic code); silently absorb written duplicates (hides mistakes). Review with the user: whether written duplicates should be errors or warnings. - Inference carries a union it is given and never forms one:
val u2 = uis the union; a union and its member join to the union;Tinx: T | stringtakes the members the argument leaves over (orText(u)withu: int | bool | stringgivesT = int | bool); a member argument decides noT. Why: anything less makes unions unusable in generic code; forming one would be the inference the user ruled out. Alternatives: refusing to solveTagainst a union (forces explicit type arguments everywhere). - Injection at a single site, like boxing: a member’s own type first, else the one member it
converts to, several an error naming them; a literal takes its default type where that is a
member, else the one numeric member it fits;
None/Ok(x)/an empty literal go to the one member that is an instance of their type. Why: mirrors how a value becomes anAny, and never guesses. Alternatives: choosing the first member written (order would then matter, contradicting the normal form). - Overloads: a member type is more specific than a union containing it; a union more specific
than a type every member converts to; a union argument never chooses among member overloads (an
error suggesting a
match). Why: overloads are resolved statically (settled 2026-11-02). Alternatives: generating a dispatchmatchover member overloads (dynamic overloading, which the language does not have). - A named function is adapted where written to a function type whose parameters inject into its
union parameters (
val f: (int) -> string = describe); a function value already made is not. Why: the same single-site rule as@sendablereferences. Alternatives: always requiring a lambda (a contortion for the common case). - Representation: a union whose members are all types an
Anyholds without a box is laid out as anAny(one pointer, the header as the tag); one with a scalar member is a tag, a bits slot and, if any member is a reference, a separate pointer slot. Consequently variance through containers holds exactly where the layouts agree:List[Dog] <: List[Dog | Cat],Result[T, IoError] <: Result[T, IoError | ParseError], but notList[int] <: List[int | string]. Tag numbering follows the normal form, and the layout is decided before optimization, so -O0 and -O2 agree. Why: reference unions cost nothing overAnyand keep?‘s common case free; scalar unions avoid an allocation per value; the separate pointer slot keeps the collector’s roots exact. Alternatives: every union boxed as anAny(simplest, butint | longallocates); every union a tag-and-payload value (no variance through containers, a conversion for everyResultof a wider error); one overlapping payload word (needs tag-aware root scanning). Review with the user: the variance consequence is visible to programs. match: type patterns, supertypes and sub-unions cover members; any other pattern applies to the one member it can match (0andn < 0on anint | stringreach the int), and one more than one member could match is an error; a type pattern naming no member is an error; in generic code thematchis checked as written and, at an instance where members come together, the first arm in order wins. Why: lets literals and constructors reach their member without a nestedmatch, without guessing. Alternatives: type patterns only, as on anAny(verbose).isbinds, it does not narrow:vkeeps its union type afterif v is _: string; the pattern binds a name. Why: the settledisscoping (2026-11-03) has no flow-sensitive typing, and unions should not introduce it. Alternatives: flow narrowing of the tested variable (a new, language-wide mechanism). Review with the user.- What a union can do:
==and hashing as twoAnys holding the values;===only where every member is a class or function type; a union conforms to a trait every member conforms to whose methods takeSelfonly as receiver (Display,Debug,Hash, a libraryJsonEncoder), plusEqandSendablemember-wise, neverOrd; a member call is looked up on the members’ join and on those traits, ambiguity an error. Why: printing, hashing and calling a shared superclass method are what a union is used for;Ordwould need an order between members that order-free unions cannot give. Alternatives: refusing every member call (forces amatchjust to call a method every member has); any method name every member has, structurally (breaks the nominal principle, and its result would be an inferred union). Review with the user. ?with unions: (1)Econverting toF(a member, a member’s subtype, a union of members) passes on unchanged; (2) for a unionF, the one member implementingFrom[E]converts; (3) for a unionEand a plainF, each member converts on its own; (4) otherwiseF.from(e)as before.?never adds a member. Why: unions replace hand-written wrapper error types without breaking theFromrule existing code relies on. Alternatives: a unionFconsulting noFrom(loses the bridge from wrapper errors); inferring the error union from the?s in the body (the inference the user ruled out).- Refused:
implor extension on a union; a union as a parent or as an upper bound (a lower bound is allowed); a union across@sysl/@cdeclarations and mirrors; awith { … }field path through a union field; casts, calls and construction of a union. Why: each needs a declared type or a C/Sysl layout a union does not have. Alternatives: shims that pass a tag and payload across a binding (no Sysl or C library takes one). - Chapter: a chapter of its own,
spec/unions.md, linked from types, generics, errors andmatch. Alternatives: a section of types.md (too long for one section).
- Precedence:
-
Settled on the user’s delegation 2026-11-09 (branch
unions-core): Union types: the choices the core’s implementation made (union types).- Every union is laid out as an
Anyfor now, a scalar member in a box. The chapter’s tag-and-payload layout for a union with a scalar member needs values of more than one machine word in the compiler’s intermediate code (parameters, results, fields, array elements, closure captures), which nothing else in the language has; the core ships without it. The type rules stay the chapter’s, so programs do not change when the layout lands:List[int]is still noList[int | string], and a union of references still nests in covariant containers. Why: one layout makes every part of the core correct now (exact roots,-O0and-O2alike, equality, hashing and rendering through theAnymachinery), at the cost of a box per scalar injected. Alternatives: building the multi-word value first (holds every other part of the item); a single tagged word (cannot hold alongand a pointer apart, so roots would not be exact). Review with the user: the allocation per scalar injection until the layout lands. - A copy of generic code at a union type argument is a copy of its own, so a type pattern naming
the parameter tests the union’s members,
t: TatT = int | booltaking neither a string nor anything else. Through a method called by its table, the type argument is still taken asAny. Why: a function’s copies are keyed by their type arguments, and the union is one; a method’s table slot is shared by every receiver. Alternatives: erasing every union type argument toAny(aTarm would take every value). - Members that come together through a type argument are merged when they are the same type, and
a member a subtype of another is kept, injection choosing the widest.
T | intatT = intisint;T | AnimalatT = Dogkeeps both members in the type, and aPuppygiven to it is theAnimal. Why: substitution is done where the class table is not at hand; the two forms hold the same values and match the same way, and only a message names the difference. Alternatives: absorbing subtypes at every substitution (needs the declarations at each one). x: int | stringin a pattern is recognized as a type pattern followed by bare names that are no variants, and reported with the parenthesized form; any other alternatives are checked as written. Why: a bare name is a binding, which alternatives refuse anyway, so nothing legal is taken from the program. Alternatives: deciding it in the parser (cannot tell a variant from a type there).- A
|after a type is a guard, not a union member, where the name after it is followed by an operator no type is followed by (a comparison, arithmetic,&&,||,!,is), sof(n: int) -> int | n > 0 = nis still reported as a guard on a signature. Why: keeps the existing clause diagnostics. Alternatives: refusing|after a result type outside brackets. - Messages the chapter left open are those of what is refused
and these: a pattern several members could match names them and suggests a type pattern;
None,Ok(…), a collection literal or a lambda with several members of its kind names them and asks for the type meant; a literal several numeric members fit names them and suggests a conversion, as inbyte(3); two arguments of one type parameter that agree on no type add that a type argument is never inferred as a union, with the union to write; a missing clause names the member, as insize(_: string). Why: each says what to write. Alternatives: the generic messages, which name no member.
- Every union is laid out as an
-
Settled on the user’s delegation 2026-11-10: Union types: the operations’ choices the chapter left open (branch
unions-ops; union types).?converts an error union member by member whatever the function’s error type is, not only where it is no union: anIoError | ParseErrorpassed on from a function yieldingConfigError | Invalid, whereConfigErrorimplementsFromat each, converts each member by rule 2. Why: rules 1 and 2 cannot reach this case (no member implementsFromat the union), so rule 3 as written would leave it an error with no way to say what to do butmapErr, while each member converts on its own; the extension only turns an error into the conversion a reader expects. Alternatives: keep rule 3 for a plainFonly (refuses an obvious program); implementFromat a union (a union has noimpl).- A trait with type parameters counts for a union through the one instance every member
holds:
Vector[int] | List[int]hasSeq[int]‘s methods, sou.size()andu.map(…)work although the two join on no type. Why: the chapter’s rule (“the traits the union conforms to”) names no restriction to traits without parameters, and the instance is unambiguous when the members agree on it. Alternatives: only traits without type parameters (refuses the common sequence case); every instance any member holds (ambiguous). - A member of the union found through a trait or the join is called, named as a value or read
as a field with the union seen as that type, with no conversion, as an
Anyholding its member is seen: a field of the join class is read (p.calledonPuppy | Kitten). Why: the union is laid out as anAny, which already is a value of every trait and class its member is; the field is the chapter’s “looked up where it would be on the members’ join”. Alternatives: methods only (a field of the shared superclass would need amatch). ===between a union with a value member and an object of a class is accepted, answeringfalsefor a value member, as it is between anAnyand an object; it is refused where neither side holds only objects (Dog | intagainst anAny). Why: the identity chapter’s rule forAny, which the union chapter says the union follows. Alternatives: refuse every===on a union with a value member (stricter thanAny, with no added safety).- The diagnostics’ wording: a union argument to overloads of its members says the member is
known only while running and suggests a
match; a bound a union misses says why (no order; the member that does not conform; a trait takingSelfother than as the receiver); a result with a scalar error union namesmapErr(e -> e). Why: each names the fix. Alternatives: the general messages alone.
-
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-sockets): a socket wait parks on one poller with a thread of its own, one readiness report per wait. Every socketavin.netmakes is non-blocking; an operation that would have to wait registers the descriptor with the runtime’s singlesysl.io.pollset asOneShot, under a token naming a slot that holds the waiter, and parks; the poller’s own operating system thread waits on the set and makes each reported waiter ready, and the operation is tried again. A slot is let go under one lock by whichever ends the wait, so a report arriving after a timeout finds its slot gone or taken again under a newer token and wakes nobody. Why: the monitor sleeps on a condition, which a kernel set cannot wake, and a thread blocked in the set’s wait needs nothing else; a one-shot registration per wait can never deliver a stale wake to a later wait on another thing. Alternatives: the monitor waiting on the poller with the soonest timer as its timeout (the timers then move under the poller, a larger change to settled code, which this choice does not preclude); workers polling the set between threads (no extra thread, but a worker with nothing ready then sleeps in the kernel instead of on its condition, and wakes need a second path); a level- or edge-triggered registration kept for the socket’s life (one system call less per wait, but a report for a wait that has ended can reach the next one, so every wait in the runtime would have to tolerate spurious wakes). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-sockets): a connection’s timeout bounds each wait, not the whole operation. A write that waits for room several times fails withTimedOutonly where one wait outlasts the limit, as the kernel’s per-call socket timeouts did before; the limit is kept in the connection rather than in the socket, since a non-blocking socket ignores the kernel’s. Why: a large transfer to a slow but steady peer keeps going, and the meaning ofsetTimeoutdoes not change. Alternatives: a deadline for the wholewriteorreadAll(stops a slow transfer that is still making progress). Review with the user if a whole-operation deadline is wanted as well. -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-sockets):connectparks; a Unixconnectdoes not. A TCP connection that cannot be made at once waits for the socket to become writable, then reads the socket’s pending error (SO_ERROR) for the outcome, since a secondconnectanswers “already connected” even for a refused connection on macOS. A Unix connection is made at once by the kernel or refused, so it stays a plain call and the socket is made non-blocking after. Alternatives: a blockingconnectthat the monitor compensates for (holds a worker for a round trip to the peer). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-sockets): a connection or listener cannot be closed under a thread parked on it. It belongs to the parked thread, so another thread’sclose()traps as any other use from there does, and the wait ends only by the peer, a timeout or readiness. Why: the ownership rule already decides it, and no wake path for a socket closed elsewhere is needed. Alternatives: a shared close that wakes the parked thread with an error (needs sockets shared between threads, which the ownership rule excludes; cancellation byscopeis where an outside end of a wait belongs). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-ui): Other threads reach the interface through inboxes andpost, run by the main thread from one queue (User interfaces).inbox(handle)is made on the main thread; its handler, which may captureState, stays there; theInbox[T, R]is sendable, withsend(m) -> Future[R]andask(m) -> R.post(@sendable work)queues work with no answer. Every message and post waits in one queue, so one thread’s order holds across inboxes. Why: the interface’s state is not sendable and must not become so, so the code that touches it has to be made on the main thread and only a sendable message may cross; a future for the answer reuses what already parks a lightweight thread. Alternatives weighed:postalone (a sendable closure cannot reach aState, so it could not change the interface); a sendableStatebehind a lock (every build would lock, and a write from another thread would race the build); an actor for the interface (the frame loop owns the thread, so a mailbox would still need this queue); a queue for each inbox (loses one thread’s order between two inboxes). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-ui; moved toon_frameon branchbinding-f32, which rests on the Proposedf32entry): The frame loop runs the waiting work in syslui-sdl’son_frame, at the start of every frame and before the loop decides whether to build the tree again, so work posted before a frame runs in that frame and what it writes is built in it;runruns what is left once more as it returns. The package’s binding ofappisnamed(branchbinding-defaults, see the Proposednamedentry), so it passeson_frameand leaveson_event,fontandsize, which come before it, to syslui-sdl’s own defaults; until then it copied those defaults into Avin, since a binding passed its arguments by place. Why:on_frameis the hook syslui-sdl runs first in a frame for exactly this. Alternatives weighed: a wrapper ofground, whichlwt-uiused while no real could cross into anf32(run after the tree, so its work was built a frame late);tree(called only when something was written, so it would never notice a post);on_event(called only when there are events). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-ui):handlePostedruns only what was waiting when it was called. Work that sends or posts waits for the next call. Why: work that posts itself again, a common animation shape, would otherwise hold a frame for ever. Alternatives weighed: draining until the queue is empty (simpler, but unbounded). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-ui): An ask on the main thread stops the program; a send or post there is queued. Why: the main thread handles the message, so its own wait would never end; a trap names the mistake where a hang would not. Alternatives weighed: handling the queue up to the message at once (re-enters a handler that asks, and runs work out of frame order). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-ui): Making an inbox,handlePostedandrunare the main thread’s alone, refused at compile time from code for another thread because they reach the package’s module-level state, and checked again at run time withisMainThread()(a new function ofavin.threads, answered by the runtime from the calling context).runon another thread stops the program before any window is opened. Why: a window on a thread other than the process’s first never shows on macOS, and a handler made on another thread would run on the main thread with that thread’s values. Alternatives weighed: answeringErrfromrun(a mistake in the program, not a condition it can handle); movingrunto the main thread silently (the caller’s wait for its result would be the same hang). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-ui): An inbox lasts as long as the program, and work still waiting whenmainreturns is dropped. Why: inboxes are made once, as a window’s state is, and the program ends whenmainreturns whatever its threads are doing. Alternatives weighed: closing inboxes (needs a lifetime the interface does not have yet); running the queue at exit (runs interface code after the interface is gone). -
Settled on the user’s delegation 2026-11-19 (built on branch
main-lwt): Threads pinned to the main thread, on a main scheduler of its own (Threads, User interfaces). What was missing: code on the main thread could not wait for a future, a channel or an ask without blocking the frame loop, so a handler had no way to fetch something and then set a signal.spawnOnMain(body)(and a scope’sspawnOnMain) starts a lightweight thread that runs on the main thread only; it parks as any thread does, whatever wakes it puts it on the main scheduler’s ready queue, and it carries on on the main thread. Its body is not checked as sendable and runs as the main thread’s owner of Sysl handles, so it reaches the interface’s state; only the main thread starts one (a worker that tries stops the program).isMainThread()answerstruein it;isPinnedToMain()tells it from the main thread’s own code, so anaskthere parks rather than trapping, andrunthere traps.- How the loop drives it: once a frame, from
handlePosted, which runsrunMainThreads()after the messages and posted work; and the main thread’s own waits (lock, condition, join, channel, future, select, sleep) run pinned threads as they become ready, a ready one waking the blocked main thread. syslui-sdl’s loop polls every frame, so no wake source is needed. - With no window: the same, so a plain
mainjoining a pinned thread runs it, and a loop of its own callsrunMainThreads(). - Order against posted work: posted work and messages first, in the order sent, then the
pinned threads ready by then, each once, in the order they became ready. A pinned thread that
posted work makes ready runs in the same call; one another pinned thread makes ready runs at the
next, which bounds a call as
handlePostedalready is bounded. - Cancellation and deadlock: a scope’s
spawnOnMainis cancelled with the scope, as its other threads are; the deadlock check counts a ready pinned thread as work, and its report marks each pinned threadpinned to the main thread. - A pinned thread parked when
runends stays parked and runs whenever the main thread next runs the main scheduler; whenmainreturns it is dropped, as every thread is.
Why: the interface’s state belongs to the main thread, so the code that waits and then touches it has to run there; a lightweight thread pinned to it reuses everything that already parks and wakes a thread, and the main thread stays the only one that ever touches the state. Alternatives weighed:
awaitinside a handler, which runs on the main thread’s own stack (it would have to block the frame or re-enter the loop from inside the handler); running every posted piece of work and every message as a pinned thread, which would give one order for all of it and let any handler wait (a stack for every message, the common case paying for the rare one, and a handler’s answer coming frames later); a wake source the loop waits on, the runtime’s poller descriptor or a run-loop source on macOS (needed only by a loop that sleeps when idle, which syslui-sdl’s does not); lettingrunMainThreadsfrom a pinned thread run the others (nested switching on the main thread’s stack for no gain); a body checked as sendable (could not reach aState, which is the point); time-slicing pinned threads (they share the main thread with the frames, which no slice makes fairer). Review with the user: the order of a pinned thread’s resumption against posted work (posted first, per frame, not one interleaved order) and the namespawnOnMain. - How the loop drives it: once a frame, from
-
Settled on the user’s delegation 2026-11-10 (built on branch
binding-f32): Arealcrosses into and out of any Sysl floating-point type that rounds:f32,f16,bf16andreal. A binding’s ownrealparameter, a mirror’srealfield going into Sysl, and a callback’srealanswer are rounded into the Sysl type to the nearest value it holds, a tie to the even one, as an IEEE conversion rounds: a value past its largest becomes an infinity of its sign, one below half its smallest subnormal a zero of its sign, a NaN stays a NaN, and nothing stops the program. Arealresult, a mirror’s field coming out, a callback’s parameter, and a real anOption, aResult, a tuple or a collection result holds are widened exactly. A real inside a parameter’sOption, tuple or collection is passed asrealonly, as an integer there is passed as its declared type. A binding’s own real is passed as it is first and rounded only where Sysl refuses arealthere (the shim is built again), so a Sysl function overloaded atrealandf32(sysl.math.ulp) is called atreal, unrounded, and a generic one takes the real itself. A real is not made from anf128(its arithmetic is notsysl.math.Float; Sysl widens a parameter into one itself), nor from any non-floating type. Why: Avin has one floating type, and a graphics or audio library’sf32(syslui-sdl’ssize, a canvas’s coordinates) is what a binding meets; rounding is what every conversion between floating widths does and the only one that keeps everyf32value exact on the way back. It mirrors how an integer crosses into any Sysl integer. Alternatives weighed: anf32type in Avin (a second floating type in every arithmetic rule, for the boundary’s sake); trapping where the value does not fit (a rounding is not an error, and an infinity is a legalf32); converting a real held inside a parameter’s option or collection too (integers are not converted there either, and the copy would be written element by element); rounding every real parameter at once (an overload atf32would then be chosen over the one atreal, losing precision silently). Review with the user whether arealinto anf32should trap on overflow to infinity rather than round to it. -
Settled on the user’s delegation 2026-11-10 (built on branch
binding-defaults): A binding markednamed(@sysl("f", named)) passes every argument by its parameter’s name, so a parameter it leaves out takes the Sysl function’s own default. The Avin name is spelled as Sysl spells it, each uppercase letter an underscore and its lowercase, as a mirror’s fields are (onFrameison_frame); the binding lists the parameters it passes in any order; the receiver of a handle’s method is never named; every parameter of anamedbinding has a name. A binding withoutnamedpasses by position, as before. Sysl checks the names and reports a missing parameter without a default, or a name it does not declare, with its own message at the binding. Why: a binding that had to reach a parameter behind defaulted ones copied the Sysl defaults into Avin (the ui package copied syslui-sdl’sfontandsizeand reached a private handle foron_event‘s default), and those copies go stale silently; with names, Sysl supplies and evaluates its own defaults at each call, a non-literal one included. One word on the annotation, decided per binding, changes no existing binding’s shim and needs no knowledge of the Sysl signature in the Avin compiler. Alternatives weighed: caller-side omission, where an argument an Avin caller leaves out of a binding’s call is left out of the Sysl call too (most general, but a binding would need a shim for each set of omitted arguments its callers use, and Avin’s own defaults on a binding would mean two things); a per-parameter mark such as@namedor a= sysldefault on a positional list (the binding still lists every parameter up to the last one it passes, and a mixed call needs the names anyway); naming every binding’s arguments always (would make every existing binding’s parameter names part of its contract with Sysl); copying the defaults (the stale copies this replaces). Review with the user: the surface wordnamed, and whether a caller-side form should come later. -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-scope): Cancellation by a scope stops a thread and drops its frames (cancellation).s.cancel()cancels the scope’s threads, and those it starts afterwards (which run nothing); a cancelled thread stops at its next cancellation point with its frames dropped and ends with no result:Thread.result() -> Option[T](new) answersNone, andjointraps. The cancellation points are every wait but a lock’s (sleep, join, condition, so channels, futures and promises, and a socket’s wait for its descriptor) and every safepoint poll. A socket’s wait is ended inside the runtime’s Sysl code, which may not drop its own frames (they hold the socket), so it fails the operation and the library stops the thread as soon as the operation has returned to it; no caller ever sees that failure. Why: Avin has no exceptions and a trap stops the program, so a cancellation that made each wait answer anErrwould change the type of every wait in the library and leave a computing thread unreachable; the runtime already drops an actor’s frames on a trap, and a thread shares nothing mutable outside a lock, so dropping its frames loses nothing anyone else can see. Alternatives weighed: every wait answering anErrorOption(the direction first sketched; changes every signature, and a loop that never waits is never cancelled); a cooperative flag the thread polls (a thread that forgets to look is never cancelled, and parked threads still need waking); a trap at the next wait (stops the program). Review with the user:jointrapping on a cancelled thread rather than answering anOption, which keeps every existingjoinunchanged. -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-scope): A thread is not stopped inside a region others may wait on: a lock held, alazy valbeing initialized, an Avin function Sysl called (the regions a trap already treats as in doubt), and the library’s running of what waits for a future it completed. It finishes the region and stops at its next cancellation point after. A wait on a condition is a cancellation point when the lock it lets go is the only region the thread is in; the thread then stops without taking the lock again. Waiting for a lock is not a cancellation point. Why: a mutex is the only door to shared mutable state, so a thread stopped outside every lock leaves nothing half changed, and never leaves a lock held; a lock is held briefly, so making its wait a point would buy little and race the hand-over of the lock. Alternatives weighed: stopping anywhere and releasing the locks a thread holds (leaves the state they guard half changed); making the release of the last lock itself a cancellation point (cuts library code short after its release, as a future’s completion is). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-scope): Cancellation reaches down through scopes, and only scopes. A cancelled thread stops first at the innermost scope it runs, which cancels its own threads and waits for them, and the cancellation then goes on outward; a scope opened while its thread holds a lock sets no such stop, so its threads are not cancelled with the thread. Threads started with the plainspawn, and futures’ work, are not reached by any scope’s cancellation. Why: structured joins hold only if a scope never returns before its threads, cancelled or not; unstructured threads have no owner to be cancelled by. Alternatives weighed: cancelling the thread alone and leaving its inner scope’s threads running (breaks the scope’s promise); aThread.cancel()on any thread (unstructured cancellation, which nothing here needs). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-scope): A failure does not cancel a scope by itself. A trap stops the program as before, so there is no failing thread to propagate; a thread reports a failure as aResult, and the scope’s body cancels and returns it.Scopegainscancel()andisCancelled()only, both used by the thread running the body while the scope is open. Why: the body already sees every thread’s result and decides what a failure means; ascopethat inspected results would need to know their type is aResult. Alternatives weighed: ascopeTrywhose threads returnResult[T, E]and whose firstErrcancels the rest (a second entry point for what a channel and acancelexpress); a sendable canceller a thread could call (the body can already cancel on a message). Review with the user: whether aResult-aware scope is wanted for brevity. -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-scope): The scope hands back the Sysl handles a cancelled thread’s body reached, once it has waited for the thread, as a body that returns hands them back itself; they are then in transit, for the next code to use. Why: a connection given to a thread that was cancelled is otherwise unusable by anyone, and closing it is the scope’s thread’s job. Alternatives weighed: leaving them with the ended thread’s owner (every later use traps); handing them back on the cancelled thread as it stops (it runs no code of its own then). -
Settled on the user’s delegation 2026-11-10: Actors’ turns on lightweight threads (branch
lwt-actors, scheduling). An actor on the shared executor, the default, runs each turn as a lightweight thread of its own, started with a thread’s default stack (8 MiB reserved, committed as touched, reused from the scheduler’s spares) and handing nothing over, the turn making the actor the owner of its code; a turn that waits parks, and one that computes is time-sliced. An actor given an executor of its own keeps running its turns as tasks on that executor’s workers, soExecutor.fixed(n)still bounds how many work at once and the 16-message fairness among its actors stays exact. To tell the two apart,Executor.shared()now gives back the same executor every time, compared with===. Why: a turn as its own thread is what makes a sleeping or awaiting turn free its worker; the shared pool counts a worker that sleeps or receives from a channel as working, so its few workers could all be held by waiting turns. An explicit executor is a request for a bound, and keeping it keeps every program that asked for one behaving as it did. Alternatives: one long-lived lightweight thread per actor, parked on an empty mailbox (a committed stack page or more for every idle actor, and a parked thread for each of a hundred thousand actors); every turn a thread of its own whatever the executor (drops the boundExecutor.fixed(n)asks for, and theactors_fairness/actors_waitingbehaviour on one worker);spawn‘s executor as anOption[Executor] = None(breaks the positionalspawn(b, Stop, ex)); a publicExecutor.isShared()(more surface for one library’s need). Review with the user: whether an explicit executor should still bound an actor once every turn could be a thread. -
Settled on the user’s delegation 2026-11-10 (built on branch
train-2): A scope’s cancellation does not reach actors (cancellation, scheduling). An actor started by a scope’s thread is a top-level actor and runs on when that thread is cancelled; an actor’s turn, a lightweight thread started as a plain thread is, is never cancelled by a scope, though the scopes it runs cancel their own threads. The waits a turn makes need nothing of their own: a turn waits only in the library’s waits (a future’sawait, so anask; a sleep, a channel, a condition, a socket), every one already a cancellation point for a thread that can be cancelled. An asker cancelled in anask‘sawaitleaves its question in the actor’s mailbox, handled in its place among the messages told, and the reply completes a promise nobody awaits, which also takes the ask’s timer out. Why: cancellation reaches down through scopes and only scopes, and an actor is owned by its parent actor or by nobody, never by the thread that happened to start it, so tying its life to that thread’s scope would make where an actor is spawned decide when it ends; cancelling a turn would stop an actor halfway through a message, leaving its fields half changed with no lock to guard them, and break one turn at a time. Alternatives weighed: stopping the actors a cancelled thread started (structured actors, which the actor tree already provides through parent actors); taking a cancelled asker’s question back out of the mailbox (needs a mailbox that removes from its middle, and the actor may already be handling it); making a turn cancellable by the scope that told it a message (a message has no owning scope). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-server): the server library is in the standard library, asTcpServerinavin.netandhttp.serveinavin.net.http, not a package and not a module of its own. Why: the TCP connection and the HTTP client it builds on are there already, the server shares the client’sResponseand token rules, and it is the first user of the runtime’s poller and, later, ofscopecancellation, which tie it to the compiler’s release. Alternatives: a packagedev.avinlang.http(versioned apart, but it would duplicate the client’s types or depend on the standard library’s privates); a moduleavin.net.server(one more import for the one type). Review with the user if a larger web framework is wanted later: that belongs in a package on top. -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-server): each connection is served in an actor’s first turn, supervised withStop, rather than on a plain lightweight thread. Why: a trap in a thread stops the program, and an actor is the only place a trap is contained; a connection’s handler is the place a server most needs a bug to cost one connection. The actor’s first turn runs the whole connection and the actor stops after it; anonStoppinggiven before the connection is served runsfailed(which writes the500) and closes it, since astoppingblock is given only after the body has run. Alternatives: a lightweight thread per connection (a handler’s trap stops the server); an actor per request (a mailbox and a turn per request, for no gain). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-server): the connections’ actors run on an executor of the server’s own,Executor.fixed(maxConnections). Why: a connection’s turn parks on its socket for as long as the connection lives, and on the shared pool, about one worker per processor, those parked turns would keep every other connection waiting for a worker; the workers are lightweight threads, so a worker per connection costs a parked stack each. Once actors’ turns run on lightweight threads of their own (stage 14, item 5), the executor may go. Alternatives: the shared pool with each wait inblocking(a trap insideblockingleaves the worker counted as waiting for good). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-server): at the connection limit, the next connection waits unaccepted in the listener’s backlog until one ends, rather than being accepted and refused. Why: the client is served late instead of not at all, and the server spends nothing on it meanwhile. Alternatives: accept and close at once, or answer503(a burst turns into failures the client must retry). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-server, reworked ontrain-2):stop()cancels the acceptor’s parkedaccept, which waits on a thread of a scope the acceptor runs; the acceptor’s own thread then closes the listener. No connection is made to wake it. (lwt-serverfirst woke it with a connection of its own to the listener, the one thing that could end a parkedacceptbeforescopecould cancel a wait.) Why: a listener belongs to the thread parked on it, so no other thread may close it, and cancellation ends a wait where it is parked without a connection the server would accept and drop, a descriptor per stop, or a host to reach itself on (127.0.0.1for0.0.0.0). The API ofstop,joinandshutdowndoes not change. Alternatives: the waking connection (kept until cancellation landed); anacceptwith a timeout polled for the stop (a delay of up to the poll, and wake-ups for nothing); a listener closable from another thread (against the ownership rule). -
Settled on the user’s delegation 2026-11-10 (built on branch
train-2): a shutdown closes a connection idle between requests at once, unanswered, and a request read once the server is stopping is answered503. The HTTP server waits for each request, its first included, throughTcpServer.idle, so stopping cancels that wait; a request being read or answered finishes, its response sayingConnection: close. (lwt-serverlet an idle connection run to its idle limit, answering503to a request arriving meanwhile, since nothing could end the wait from outside.) Why: an idle connection has nothing in flight, so closing it loses nothing, andjoinno longer waits up toidleTimeout, or for ever where it is zero. Alternatives: idle connections ending at their limit (a slow shutdown); serving requests on connections already open (a chatty client keeps the server up for ever). -
Settled on the user’s delegation 2026-11-10 (built on branch
train-2): a shutdown reaches a connection’s actor throughTcpServer.idle, a scope the actor’s turn runs around each idle wait, not a scope around the turn.idle(wait)registers the wait with the server, runswaiton a thread of a scope opened by the calling thread, and parks that thread on a promise that the wait completesfalseonce it answers andstop()completestruefor every registered wait; ontruethe scope cancels the wait. Its result isSomeof the wait’s answer, orNonewhere the server stopped first, andNoneat once,waitnot run, where it was already stopping. The acceptor’sacceptgoes through the same path, so what follows an accept (counting the connection, starting its actor) runs on a thread nothing cancels. Why: a scope’s cancellation does not reach actors, and an actor’s turn is never cancelled (settled fortrain-2above), so the server cannot cancel a turn; it can only cancel a scope the turn runs, andcancelmust be called by the thread running that scope’s body, which is why the turn parks on the promise and cancels itself. Only the wait is cancelled, so code answering a request, and a trap in it (which fails the connection’s actor alone), stay on the turn. A promise per wait and a registry keyed by number wake only the waits that exist, not every connection on every request. Costs: a scope and a lightweight thread per idle wait, and aVectorcopy of each read the HTTP server makes there, since a wait’s result must be sendable; a trap inwaitstops the program, as a trap in any thread does. Review with the user: it addsidletoTcpServer‘s public API, the one way a protocol on it tells the server which waits a shutdown may end. Alternatives: the connection’s wholeserveon a scope’s thread with the turn watching it (a trap inservewould stop the program instead of failing the actor, and a request in flight would be cancelled with it); a server-wide condition notified when any wait ends (wakes every idle connection per request); shutting down the read side of idle sockets from the stopping thread (not cancellation, and a socket belongs to the thread that uses it); a per-connection server handle carrying an idle flag (the same cancellation, plus a race between the flag and the wait’s answer). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-server): HTTP limits and refusals. Timeouts bound each wait, as a connection’s do:readTimeoutwhile a request is read (408once one runs out mid-request, and a quiet close where a connection sent nothing),writeTimeoutwhile a response is written, andidleTimeoutbetween requests;maxHeaderBytes(16 KiB) bounds the request line (414) and the head and a chunked body’s trailers (431);maxBodyBytes(1 MiB) bounds a body by its length before it is read, or as chunks arrive (413). A request with bothContent-LengthandTransfer-Encoding, two lengths that differ, a coding list not ending inchunkedor a header folded onto a second line is400, and a coding besideschunked501. Every refusal closes the connection after shutting its side and reading what the client still sends for half a second, so the answer is not lost to a reset. Why: RFC 9112’s choices where it gives the server one, and per-wait timeouts keep one meaning for “timeout” across the library. Alternatives: a deadline for the whole request (stops a slow upload still making progress; review with the user if wanted beside the per-wait limit); decodinggziprequest bodies (a dependency for a rare case). -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-server): aResponseis the client’s class, given makers (Response.text,bytes,empty,withHeader) andhttp.reasonPhrase; a handler is a plain@sendable (ServerRequest) -> Response; routes are a vector given toRouter(routes), made byRoute(method, pattern, handler)orRoute.getand its siblings, androuter.handleis the handler. Why: one response type for both sides; a vector literal spans lines, where a builder’s chain of.get(…)cannot, since a line starting with.does not continue the one above. The server writesContent-LengthandConnectionitself and refuses (traps on) a status outside 200 to 599. Responses are whole bodies; a streamed (chunked) response is later work. Alternatives: a builderRouter().get(…)(a chain on one line, or avarreassigned); a response writer handed to the handler (streaming, but a handler that forgets to finish it). Whether a line that starts with.should continue the expression above, left for review here, is answered under Proposed: it does, so a builder’s chain may now span lines. -
Settled on the user’s delegation 2026-11-10 (built on branch
lwt-server): routing: segments matched one for one with the request’s decoded segments,:namebinding a non-empty one, the first matching route winning; aGETroute answersHEAD;404for a path no route matches and405withAllowfor one matched for other methods. Why: the smallest router that covers a service’s paths, with escaped and raw Unicode routing alike and an escaped/staying inside its segment. Alternatives: wildcards for the rest of a path and patterns in a segment (later, if programs need them). -
Settled on the user’s delegation 2026-11-11 (designed on branch
incremental-design): Lowering is made cheaper before anything is cached: the build plan fixes tuple records (a tuple’s ancestors listed as the product of its parts’ traits, each with its own entries: 33,858 of marshal’s 71,646 functions) and lowering’s constant factors first. WHY: lowering is 75 to 80% of an edit’s rebuild and most of it is that defect; a cache built first would key and store tens of thousands of instances no program needs, and its measured win would be the defect’s. Alternatives: cache first and fix after (stores the waste and measures the wrong thing); fix only (an edit still lowers the whole program). -
Settled on the user’s delegation 2026-11-11 (designed on branch
incremental-design): The unit of reuse is the instance, grouped a file per source module; the front end stays whole-program and uncached. WHY: monomorphization makes the instance, not the module, the thing whose code exists, and closed-world passes decide per call site; checking marshal is about 4 s of a 65 s rebuild, and the checker numbers every symbol of the program by index, so caching its output per module is a rewrite, deferred until a measurement says the front end is the larger part. Alternatives: per-module object files with generic code emitted where it is used (duplicates instances across modules and loses closed-world devirtualization); a cache of the checked front end per module first (targets 6% of the time); whole-program LLVM text cached by the program’s hash (only helps an unchanged program, which the executable record already does). -
Settled on the user’s delegation 2026-11-11 (designed on branch
incremental-design): An instance’s key is its identity spelled by qualified names, its typed body printed canonically, the layouts and records it reads, and the world facts the whole-program passes used on it, beside the compiler’s stamp, level and kind. WHY: the printed typed tree carries every resolution and inference the checker made, so a change elsewhere that alters what the body means alters its key without a dependency graph of the source; world facts per call site let a new implementing class rerun the passes on its callers without lowering them again. Alternatives: the declaration’s source text plus the hashes of the modules it imports (misses inference changes through a callee’s result, and invalidates on every unrelated change to an imported module); one hash of the whole program’s world for the passes (any new class reruns every pass on every instance). -
Settled on the user’s delegation 2026-11-11 (designed on branch
incremental-design): Emitted names are stable: a string by its content’s hash, a descriptor or record by its type, a closure or trap site by its function and place, the module-level tables in a codegen unit of their own. WHY: today’s numbering by discovery order lets one new instance renumber the rest, which changes every unit’s text and defeats both caches. Alternatives: keep the numbering and patch indices at emission (every reused text rewritten anyway); number per module (still moves when a module gains a string). -
Settled on the user’s delegation 2026-11-11 (designed on branch
incremental-design): The instance cache lives in the program’s.avin/build/incremental/<kind><level>/, content-addressed, published by rename, with no lock; a missing, short or mismatched entry is a miss; a build trims what its manifest does not name and was not used in the last hour. WHY: the same scheme as the unit and shim caches, safe for two builds at once because a key’s bytes are the same whoever writes them. Alternatives: a lock per program directory (serializesrunandtestand the language server); the toolchain’s shared cache for everything (instances of a program’s own types are useless to any other program; sharing library-only instances can come later, since the keys already allow it). Review with the user: whether library-only instances should later go to the toolchain’s cache, shared across programs. -
Settled on the user’s delegation 2026-11-11 (designed on branch
incremental-design): An incremental build is tested against a clean one: every edit in the compiler’s tests checks that the incremental build’s LLVM text equals a build with no cache, and the counts inAVIN_BUILD_LOGthat only the affected instances were lowered;AVIN_INCREMENTAL=verifycompares every reused instance with a fresh lowering. WHY: a key missing a dependency is the one way this design fails, and it fails silently; the clean build is an oracle that needs no list of what each edit should touch. Alternatives: count-only tests (prove reuse, not correctness); trusting the key (no defence against a missed dependency). -
Settled on the user’s delegation 2026-11-11 (built on branch
option-nested):Option[Nothing]takes the form of the options it is seen as inside other values. Its one value,None, is null as a pointer and the constantNoneobject as an object, so the program-wide plan keeps it a pointer when every view of it inside another value (aVector[Option[Nothing]]as aVector[Option[Dog]], aResult, a function’s result, an option, a tuple, a data field, a map value) sees it as an option kept as a pointer, and an object when every such view sees it as one kept as an object (Option[int],Option[Option[Dog]]); a bareOption[Nothing]written as an option of the other form is converted where it is written, as before. Why: options of classes and strings stay pointers in the common program that builds a collection ofNones, at no cost in any other. Left as full objects (correct, slower): a program that sees it inside other values both ways, since one vector of it could flow to both and no single form serves; and one that sees it as an option of a type parameter (Vector[Option[Nothing]]asVector[Option[T]]in generic code), since the view is recorded once for every instance. Alternatives: (a)Nonenull in every option, objects included, removing the conflict but adding a null test to every match, method call and table entry on an object option; (b) copying the containing value at the view, which a view by definition does not do and which breaks identity of mutable containers; (c) keepingOption[Nothing]always an object, the old rule, which stores every option of the program as an object as soon as one nested view to a pointer option exists. With it, anOption[Nothing]written as another option is always that option’s ownNone(the null, or that option’s constant object, where an object option used to receive theOption[Nothing]object itself), so as anAnyit has the option’s type and equals that type’s otherNones, as the equality chapter’s rule by run-time type says; one seen inside a vector as anOption[Dog]and then boxed is anOption[Dog]too. A view inside an object-form value still leaves theOption[Nothing]object there, as any view leaves a value as it was made. -
Settled on the user’s delegation 2026-11-11 (built on branch
https): TLS’s API (system library). A module of its own,avin.net.tls:TlsStream.connect(host, port, settings), andTlsStream.client(tcp, host, settings)/TlsStream.server(tcp, settings)over aTcpStreamthe caller made;TlsClient(the authorities it adds) andTlsServer(certificate, key)(PEM text, checked byTlsServer.of) as immutable sendable values. Inavin.net.httpanhttpsURL just works (port 443 by default),Request.withTls(client)choosing the settings, kept across redirects;http.serve(…, tls = Some(server))serves HTTPS. A traitByteStream, whichTcpStream,UnixStreamandTlsStreamimplement, lets the HTTP code run over either, andReadAheadbecame public so the TLS module shares the line reading. Why: the URL decides TLS, as a reader expects; settings are values, so a request, a thread and an actor carry them freely; the stream over a caller’sTcpStreamkeeps that connection’s timeout and cancellation without a second set. Alternatives:TlsStreaminavin.netitself (every TCP program would then build OpenSSL, since a module’s bindings come with it); aTlsClientholding one OpenSSL context for many connections (a context’s reference count is not atomic, so it could not be shared between threads; a context is made per connection instead, which reads the machine’s store each time, a few milliseconds); atrust(pem)that checks the PEM at once (it would need a context; a PEM that is not one isCredentialsat the connection instead). -
Settled on the user’s delegation 2026-11-11 (built on branch
https): the trust model. A client trusts the machine’s store, through OpenSSL’s default paths, plus whatTlsClient.trust(pem)adds; it always checks the host name (a name or an address), sends it for SNI, and speaks TLS 1.2 at the least, none of which can be turned off, as the Sysl packageopenssldecides. Why: trust that only grows cannot be misused to accept a bad certificate; a private, corporate or test authority is one case. Alternatives: a switch to skip verification (refused: it is how bad certificates get accepted); a bundled set of roots (it goes stale). Gap: on macOS the store is thecert.pemof Homebrew’s OpenSSL, not the Keychain, so a root added only to the Keychain is not trusted; thesyslsession would queue reading the Keychain in theopensslpackage on request. Review with the user whether Keychain roots are wanted. -
Settled on the user’s delegation 2026-11-11 (built on branch
https): TLS errors.TlsErrorisTransport(IoError),Certificate(text),Handshake(text)andCredentials(text); anHttpErrorgainsTls(TlsError), aTransportfailure stayingIoas forhttp. After the handshake a TLS failure in a read or write isIoError.Other("TLS: …"), so aTlsStreamis aByteStream.openssl0.2.2 reports a refused certificate as one error, soCertificatecovers an untrusted, self-signed or expired certificate and one for another host alike; the mapping is the one functionhandshakeErrorinlibrary/avin/net/tls/tls.avin, andopenssl0.2.3’sError.refusal()(HostMismatch,Expired,Untrusted,Other) lets it splitCertificateinto those kinds there alone. Alternatives: oneTls(text)error (a program could not tell a refused certificate from a broken connection); typed errors for every read and write (everyByteStreamuser would need a second error type). -
Settled on the user’s delegation 2026-11-11 (built on branch
https): a connection’s end and timeouts over TLS. The end of the stream is the peer’sclose_notifyor the TCP connection closing, both read as the end, since many servers close without aclose_notifyand HTTP frames its bodies; a body read to the connection’s end can therefore be cut short undetected, as over TCP. Every wait, the handshake’s included, is a wait of the TCP connection beneath, under itssetTimeoutlimit and cancellable by a scope;httpsets the request’s timeout before the handshake, andhttp.servebounds the handshake byreadTimeout. A handler that traps on a TLS connection has it closed unanswered. Alternatives: an error for an end withoutclose_notify(it would refuse ordinary servers); a handshake timeout of its own (one more limit to set). Review with the user whether a body read to the connection’s end should requireclose_notify. -
Settled on the user’s delegation 2026-11-11 (built on branch
https): the standard library’s Sysl packages. The library names the Sysl packages its own bindings reach inlibrary/library.hocon, a manifest whosesysl-dependenciesblock is read as a package’s is. One joins a program’s shims only where a binding or handle the program compiles names a Sysl item inside it, the package’s name being a segment of the item’s name before its last (sh.sysl.openssl.client); a program naming the same package keeps its own, unless both are releases of one repository and the library’s is later. So only programs that reachavin.net.tls(avin.net.httpamong them) need OpenSSL installed, and the Homebrew formula depends onopenssl@3. Why: a dependency written as a package’s, without making the library a package (anavin.hoconthere would makelibrary/testsa package’s tests). Alternatives: always adding the library’s packages (every program with a binding would fetch and link OpenSSL); the runtime depending onopenssl(every program would link it); a table from module to package in the compiler (a second place to keep in step). -
Settled on the user’s delegation 2026-11-11 (built on branch
c-view-fields): Views lent by a field and to a callback:- A field accessor lending a view says
view,length:and perhapswritable, as a binding does, and nothing else;length:is a C expression inselfand the indices, evaluated after the field is read, whether or not it is null. Why: the words a binding lending its result already uses, so a reader learns one form. Alternatives: a separatebuffer:word for fields; evaluating the length only for a non-null pointer, which would let alength:that dereferences the struct run only sometimes. - The C unit, not the checker, refuses a
writableview of aconstfield, by glue that assigns through the pointer, since the field’s type is the header’s and the checker never sees it. Why: a binding’s prototype saysconstin Avin’s source, a field’s does not. Alternative: making the accessor spell the field’s C type, which repeats the header. - A view lent a callback may be an
Option, null with any lengthNone, and otherwise null follows a binding’s rule: an empty view for a length of zero, a stop for any other (C lent the function given to `f` null); a negative length and one past the greatestintstop the program at the binding’s call. Why: one rule for every view. Alternative: refusing anOptionin a callback, which would make a C library that passes null for an empty chunk stop the program. - A view lent a callback has no lender and belongs to the code the callback runs in: another thread’s use stops the program, a thread the callback starts among them, since the view is not handed over with a body that captures it as a handle’s view is with its lender. Why: C frees the memory when the callback returns, so it must not be read anywhere the closing cannot order before the free. Alternative: handing it over like a block, which lets another thread read while the callback returns and C frees. Review with the user only if a library needs a thread to read a chunk in place.
- A callback view’s length is converted through
longbefore the view’s own checks, so an unsigned 64-bit length past along‘s range stops the program as that conversion does, and any smaller one past the greatestintasmore bytes than a view holds. Why: the conversions a callback’s integer arguments already use. Alternative: a dedicated 64-bit unsigned comparison, which only changes the message. - The trap texts name the binding:
the `ByteView` lent to the function given to `f` was closed when it returnedand… belongs to another thread; a field’s view is a handle’s view and saysthe `ByteView` of `Face` was closed when `Face` was used again.
- A field accessor lending a view says
Settled on the user’s delegation 2026-11-11 (built on branch json-derive): JSON derivation.
-
One
JsonErrorfor parsing and decoding, the path its last field with a default:JsonError(message, line, column, offset, path: List[PathStep] = []),inField/atIndexputting a step in front,pathText()writingitems[2].name, andDisplayputting that text and a colon before the message where the path is not empty. Why: a program handles one error type from the package, and every existingJsonError(message, line, column, offset)keeps compiling. Alternatives: the derivation chapter’sJsonError(path, message, line, column), which drops the offset and breaks every existing construction; a separateDecodeError. -
JsonReaderreads text in memory,JsonReader(text, maxDepth = 512), withbeginObject,nextKey,beginArray,nextElement,takeNull,readString,readBool,readInt,readLong,readReal,readJson,skipValue,endanderror(message), the last naming the start of the last token read. Why: the derivations need exactly these, and the tokenizer is the parser’s own, so its messages areparse‘s. Alternatives: reading a byte stream now, which is the streaming reader’s item; these methods are the seam it plugs into. AJsonWriter(out: Writer)writes compact text only,writeNull()fornull. (The streaming reader has since taken this reader’s place: see the Proposed entry oneJsonReaderbelow.) -
Numbers: an
intor alongreads any whole number in range,3.0and1e3included, asJson.asInt/asLongdo; a fraction or a number out of range is an error naming it. A NaN or an infinity is writtennull(asrenderwrites it) andnulldoes not read as areal. Alternatives: integer literals only;nullreading back as NaN, which would make everyrealfield silently nullable. -
Option[Option[A]]:Some(None)andNoneboth writenulland read back asNone. Why: JSON has one null. Alternatives: refusing to derive for nested options. -
Maps are
HashMap[K, A]andTreeMap[K, A]withK: JsonMapKey, a trait the package implements forstring,intandlong(the digits, read back only from whattoLongOptionreads); a key written twice keeps its last value. Why: an impl of a trait is for a data type or a class, not for theMaptrait, and must take its type’s parameters in order, soMap[string, A]cannot be named. Alternatives: string keys only. Review with the user: a field typed as theMaptrait (what a map literal is typed as) cannot derive the JSON traits; covering it needs the language to let a library trait be implemented for a trait type. -
Unknown keys are skipped and a field written twice is an error (as the chapter says); a second discriminator key after the first is an unknown key. A missing field’s error is at the object’s closing brace, with the object’s path. The nesting limit counts a skipped value’s containers too.
-
Entry points
json.encode(value) -> stringandjson.decode[A](text, maxDepth = 512), the second refusing anything but white space after the value. Alternatives: only the traits’ methods, leaving every program to make a writer and a reader. -
Settled on the user’s delegation 2026-11-11 (built on branch
time-calendar):startOfYear(),startOfMonth()andstartOfWeek()on aDateTimeanswer midnight of that day, whileendOfMonth()keeps the time of day, as the chapter says. Why: a start is the first moment of its span, asstartOfDayis; keeping the time would maker.startOfMonthmean “the same time on the 1st”, whichr.withDay(1)already says. Alternatives: keep the time of day for all four (symmetric withendOfMonth, but two spellings ofwithDay(1)); makeendOfMonththe last microsecond of the month too (a start/end pair, but the chapter decided “at the same time of day”). Review with the user whetherendOfMonthon a reading should rather be its month’s last microsecond. -
Settled on the user’s delegation 2026-11-11 (built on branch
time-calendar): a calendar answer outsideDate.MintoDate.Maxtraps with a message naming the date (the date +5881580-07-31 is outside Date.Min to Date.Max), or, where the answer is a count of days with no year to write (a weekday search,startOfWeek,DateTime ± Duration),the date N days from 1970-01-01 is outside Date.Min to Date.Max; the makerdate(y, m, d)traps the same way, and a year far beyond the dates (withYear(long.MaxValue)) is checked before any arithmetic, so it never overflows on the way.daysUntilandDateTime - DateTime, whose answers are anintand aDuration, trap as an integer overflow does. Why: the chapter says leaving a type’s range traps “as an integer overflow does”; a message naming the date says more thaninteger overflowwhere there is a date to name. Alternatives: a bare integer overflow trap everywhere (shorter code, a less useful message); clamping to the bounds (silently wrong). -
Settled on the user’s delegation 2026-11-11 (built on branch
time-calendar):withYeartakes along, the typeyear()answers, sod.withYear(d.year + 1)needs no conversion; the otherwith…take anint. Alternatives:intlike the makers (a conversion at every use ofyear()), or changingyear()toint(every year of aDatefits, but a change to step 1’s fields). -
Settled on the user’s delegation 2026-11-11 (built on branch
time-calendar):with…andstartOf…onZonedwait for step 3, which buildsResolutionand the zone’s handling of a skipped or repeated reading they rely on; step 2 givesZonedonlyisoWeek()andisoWeekYear(), which need no resolution. -
Settled on the user’s delegation 2026-11-11 (built on branch
generic-variant-inference): A shared variant name takes the type its siblings decide: a bare or called variant name several data types share, passed for a generic function’s type argument, is decided by what the call’s other arguments decide of that type argument:assertEq(p.segments(0), MoveTo(10.0, 20.0))takesT = Segmentfrom the first argument, soMoveToisSegment‘s. It is checked after the arguments that are not such names, wherever it is written, sosame(MoveTo(1.0, 2.0), segment)resolves too, and named arguments go the same way. The elements of a collection literal and the two branches of anifagree the same way:[Close, segment],if c then Close else segment. Only the data type is taken from the others; its type arguments are left for the variant’s own fields to decide, so a later argument may still widen them, as any argument’s may. Where every argument for the type argument is such a name, or the others decide a type that is none of the name’s owners, the use is refused with the usual message. Why: the name’s type is fixed by the call before it is chosen, exactly as with a parameter of the data type itself, and checking the shared names last makes the result independent of argument order, which a reader expects ofassertEq(a, b)andassertEq(b, a). Alternatives: left to right only, sosame(MoveTo(…), segment)is refused (order-dependent, and the expected value usually comes second); taking the decided type with its type arguments fixed too (refuses a later argument that widens them); a second checking pass over the whole call (the same answers here, with each argument checked twice). -
Settled on the user’s delegation 2026-11-11 (built on branch
c-binding-gaps): An array C fills, its length known before the call: anout T *parameter (one star, againstout T **for an array C allocates) named witharray:, itslength:a C expression over the parameters evaluated in the glue before the call; the gluemallocs that many elements (at least one), C fills them, and they are copied into anArrayand freed withfree. A negative length or one past the greatestintcalls nothing (the glue answers a zeroed result) and the length stops the program when it is read; length checks now come before the null check for every array C answers. It is never in anOptionand takes nofree:. Why: Cairo’scairo_get_dashwritescairo_get_dash_countdoubles, a length no parameter carries; the wordsarray:/length:are the ones an array C answers already uses, the number of stars says who allocates, and the answer is the sameArrayin the result. Alternatives: an AvinArraypassed in, checked by the glue to be at leastlength:long (the library would make and size it, and a precondition the binding cannot see becomes the program’s); acapacity:word on an in-array; the array allocated in the collected heap (a moving or concurrent collection, and ablockingcall, would need it pinned). -
Settled on the user’s delegation 2026-11-11 (built on branch
c-binding-gaps): Several arrays in one call:array:/bytes:take a list,length:andfree:then lists of the same length in the same order,""infree:freeing nothing; the glue writes each length through its own pointer and has a free function per array (avin_c_array_free_<symbol>_<j>). Why: the existing words, with the list shapekeeps:already has; one array keeps its single-string form. Alternatives: repeatingarray:/length:/free:groups in order (order-dependent pairing nobody can see); marking the count in the prototype (length(glyphs) out int *num_glyphs), which would drop the count from the result and reuse a marker that means something else forinout; afree:keyed by name (no map literal in an annotation). -
Settled on the user’s delegation 2026-11-11 (built on branch
c-binding-gaps):nullin a prototype passes null: a word before a pointer parameter’s type; the parameter is no Avin parameter and no out value, and a function whose caller chooses (Cairo’s clusters, wanted or not) is bound twice, once withoutand once withnull. Why: what is passed is fixed per binding, so the result’s type stays fixed; the prototype is where the other per-parameter words (out,inout,userdata,length) already live. Alternatives: an AvinboolorOptionparameter choosing at run time (the result’s shape would depend on a value); askip:list on the annotation (a second place saying what one parameter is). Review with the user: whethernullshould also let an AvinOptionparameter decide. -
Settled on the user’s delegation 2026-11-11 (built on branch
c-binding-gaps): A field accessor reads and writes an enum mirror: the C unit checks the field is of an integer type (any, not only the mirrored enum) and measures it; a read value no variant holds stops the program as an enum result does (the field `f` of `H` held a value no variant of `M` holds), a write stores the enumerator’s value, and anOptionof a mirror is refused. Why: a struct mirror’s field already crosses this way, and Cairo’s path header is a union member; accepting any integer type lets anintfield holding an enum’s values be mirrored. Alternatives: requiring the field to be exactly the mirrored enum (the field’s type is the header’s, which the checker never sees, so the C unit would compare type names); reading it as anintand converting in Avin (the workaround cairo used). -
Settled on the user’s delegation 2026-11-11 (built on branch
c-binding-gaps):attach:failing answersErrwhere the binding answersResult[H, E]: a binding whose C result is a handle of a class withattach:, which keeps something and answers no out values, may answerResult[H, E],Ean integer type or an enum mirror; whenattach:answers non-zero, the record is undone, the handle given back (its kept list cleared) andErrof the answer returned, converted as a status code is. Without theResultthe trap stays. Why: Cairo’scairo_surface_set_user_dataon a surface in error answers the surface’s own status, so theattach:answer is exactly the error the program wants, and no new word is needed; theResultis the existing status shape. Alternatives: a class-levelstatus:C expression evaluated on every new handle (a new word, and a check on bindings that keep nothing); answeringNonefor a refused attach (loses the reason); keeping the trap and the library’s pre-checks (what cairo had to write). -
Settled on the user’s delegation 2026-11-11 (built on branch
array-refmaps): An array’s descriptor carries a per-element reference map (the runtime half of the union tag-and-payload layout, under Settled → unions → Representation). An array of elementskwords wide names one of three tracers: every element one reference (avin_rt_trace_array, as before), no reference word (the ordinary tracer with no offsets, as before), or a mapped element (avin_rt_trace_array_map), whose descriptor lists the byte offset within an element of each reference word, in the same trailing offset list an object’s descriptor uses for its fields; the tracer reads exactly those words of every element and never a scalar word, so a union’s bits word holding something that looks like a heap address keeps nothing alive. The compiler builds every array descriptor througharray_descriptor(…, words), which picks the fast path whenever the map fits one; a one-word element is never mapped. Handing a value over to another thread reads the same words through the same scanners (scan_object). The two fast paths compile to the same machine code as before. Why: the offset list already exists, is what the emitter writes for objects, and costs nothing for the arrays every program has today; elements of a union are at most three words, so a short list per element is cheap. Alternatives: a bit mask word per descriptor (one word, but a second format beside the offset list, and a bit scan per element); a tracer per element shape generated by the compiler (fastest, but code per instance and a new symbol per shape); keeping union elements boxed in arrays (no runtime change, an allocation per element). -
Settled on the user’s delegation 2026-11-11 (built on branch
json-stream):avin.io.Reader, a trait of one method,read(max) -> Result[Array[byte], IoError], an empty array at the end, whichfs.File,net.TcpStreamandnet.UnixStreamimplement with thereadeach already had. Why: the streaming JSON reader reads “a byte stream”, and the three byte sources had the same method with no common type, so a function could take only one of them. Alternatives: a read function(int) -> Result[Array[byte], IoError]passed to the JSON reader (no library change, but every caller writes the lambda and other byte readers gain nothing); aByteSourcetrait private to the json package (each source wrapped by hand). Standard input and a command’s output are not readers yet; making them so is later work when a program needs it. -
Settled on the user’s delegation 2026-11-11 (built on branch
json-stream): the streaming JSON reader’s interface,JsonReaderwith the pull events ofJsonEvent(next,peek,depth) beside the calls the derivation chapter’s decoder makes (beginArray,nextElement,beginObject,nextKey,readString,takeNull,skipValue,error), completed withreadBool,readLong,readInt,readReal,readValue,readDocumentandfinish; made byfromReader,fromStringandfromBytes. Why: one type serves both a program walking a large document and a derived decoder, and the events are the smallest set that names every token; a decoder’s calls are each a step or two over them. Alternatives: callbacks pushed per event (a decoder cannot pull a field’s value at its type); an iterator of events (noResultper step, so a fault would have to trap); a reader of several values in a row (JSON lines), later if a program needs it, asparsetakes one value too. Review with the user: the variant names (StartObject…EndOfText), chosen to stay apart fromJson‘s own variants in the same module. -
Settled on the user’s delegation 2026-11-11 (built on branch
json-stream): a stream givesparse‘s faults atparse‘s places, and a failure to read is aJsonError(the text could not be read: <the IoError's message>) at the place reading stopped, rather than a separate error type. Bytes that are not UTF-8 are found as they are read, so a grammar fault earlier in the text is reported first, whereparseof bytes, which checks the whole text first, reports the UTF-8 fault. Why: one error type for the decoder to carry, and a stream cannot look ahead to the end. Alternatives:Either[IoError, JsonError]per call (every decoder’s signature grows); trapping on a read failure. -
Settled on the user’s delegation 2026-11-11 (built on branch
json-stream):JsonError‘sline,columnandoffsetarelongs (they wereints). Why: a stream larger than memory runs past two gibibytes, and a minified one is on a single line, so anintcolumn or offset would trap on overflow. Alternatives:ints that saturate (a wrong place, silently); alongoffset only (a column of a long line still overflows). -
Settled on the user’s delegation 2026-11-11 (built on branch
json-stream): a parent after:may be named through its module,class Body: shapes.Base("b"), io.Reader, resolved as a type writtenm.Tis. Why: it was refused with “expected a superclass” though the same name is a type everywhere else; found whenfs.Filewas made anio.Reader. Alternatives: none weighed; the bare name through an import stays the common form. -
Settled on the user’s delegation 2026-11-11 (built on branch
json-stream): oneJsonReader, the streaming one, which the derived decoders read through. The in-memory reader of the derivation item is gone and so are the token methods it added toparse‘s private reader;json.decode[A](text)reads throughJsonReader.fromString. Where the two readers named a call differently the streaming names stay:readValue(notreadJson) andfinish(notend). Why: one reader means one grammar and one set of places for a fault, whether the text is in hand or arriving;readValuepairs withskipValueandreadDocument, andfinishcannot be read as the end of an object or array, asendcan; the streaming names had the more users (its tests, the chapter’s example, three corpus programs) against one test and one decoder line. A text reader is made byJsonReader.fromString(text), since the class’s constructor takes a source; the derivation entry’sJsonReader(text, maxDepth)no longer compiles (its only users were the package’s own test andjson.decode). Alternatives: keeping both readers behind a trait the decoders take (two grammars to keep in step, and a decoder call through a trait for every token); keeping both names of each call (two words for one thing in the chapter’s table); a second constructorJsonReader(text)(the language gives a class one constructor). -
Settled on the user’s delegation 2026-11-11 (built on branch
json-stream): where the two readers worded an error differently, the settled derivation wording stays:expected a boolean(notexpected true or false),found a booleanfortrueandfalsealike (notfound false), andthe number N is not a whole number within an int's range/a long's range(notdoes not fit an int/within a long),readIntnaming the number as written, a fraction included. A fault in the text itself is the stream’s, worded asparsewords it:truread as aboolisunexpected word 'tru' where a value was expected, no longerexpected a boolean, found 't', and text ending where a string was wanted isunexpected end of text where a value was expected, since the stream tokenizes before the decoder asks for a kind. A fault met while an array looks for its next element ([and the end,[1 2]) carries the array’s path, not an element’s ([decoded as aVector[int]has an empty path where it had[0]), since no element has begun. Why: the derivation’s messages were settled and name kinds throughout (a number,a string), and a stream cannot answer “what character is next” without reading a token. Alternatives: the stream’s wordings throughout; the derivation’s character-level messages, which would make the stream peek bytes outside its tokenizer. Review with the user: the[0]path a fault at the next element used to carry. -
Settled on the user’s delegation 2026-11-11 (built on branch
json-stream):json.decode[A](source: Reader, maxDepth = 512), an overload ofdecodereading a value of a derived type as its text arrives, from a file, a connection or anyReader, refusing anything but white space after it. Why: the streaming reader exists so that a document need not be held whole, and a program decoding its own type should not have to build the reader and callfinishitself. Alternatives:JsonReader.fromReaderandA.decode(r)by hand; adecodetaking aJsonReader(which leaves the end of the text unchecked or checks it where a caller wanted to read on). -
Settled on the user’s delegation 2026-11-11 (built on branch
json-stream):net.ByteStreamis anio.Reader(trait ByteStream: Sendable, Reader, itsreadthe trait’s), soTcpStream,UnixStreamandTlsStreamare all readers and JSON reads from a TLS connection as from a plain one. Why: both sides arrived at once, the stream item makingTcpStreamandUnixStreamreaders by name and the TLS item giving the three a commonByteStream; declaring it on the trait covers every connection, the TLS one included, with one line. Alternatives: namingio.ReaderbesideByteStreamon each class (TLS left out unless named a third time). -
Settled on the user’s delegation 2026-11-11 (built on branch
time-period):a.monthsUntil(b)counts a month whole whenb‘s day of the month has reacheda‘s (the month difference, less one whereb‘s day is smaller, or plus one going backward where it is larger), anda.until(b)is those months and the days froma + months(n)tob. Why: it is the chapter’s “as a person counts them” (2026-01-31 to 2026-02-28 is 0, to 2026-03-01 is 1), it makesb.monthsUntil(a) == -a.monthsUntil(b)always, and with months-first additiona + a.until(b) == bholds in both directions (a sweep of 21,228 pairs tests it).b - a.until(b) == aandb.until(a) == -a.until(b)fail for some pairs near month ends (2026-01-30 and 2026-03-01), and the chapter now says so. Alternatives: the largestnwitha + months(n) <= b(answers 1 for 2026-01-31 to 2026-02-28, against the chapter); counting backward periods frombso the reverse is the negation (breaksa + a.until(b) == bfora > b). -
Settled on the user’s delegation 2026-11-11 (built on branch
time-period):p.toIsoStringwrites a period in ISO 8601’s form,P1Y2M3D, the months split into years as the display splits them,P0Dfor the empty period, and a negative part with its own sign (P-1Y-2M,P1M-3D). Why: the display1y 2mo 3dis for people; exchange formats want ISO’s, and a period’s parts may differ in sign, which a single leading-cannot write. Alternatives: a leading-when every part is negative and per-part signs only otherwise (two rules for one value); no ISO text until step 5’s parsing (a writer without a reader for a while). Review with the user whether the step 5 parser should read it (parsePeriod), which the chapter does not list. -
Settled on the user’s delegation 2026-11-11 (built on branch
time-period):toYearsPart()andtoMonthsPart()carry the months’ sign (months(-14)is -1 year and -2 months), asDuration‘s parts do, and the display and ISO text write each part with that sign (-1y -2mo).p.isZero()asks for the empty period, asDuration.isZero()does. Alternatives: floor division (-2 years and 10 months, which reads as something else); noisZero(p == Period.Zerosays the same, less directly). -
Settled on the user’s delegation 2026-11-11 (built on branch
time-period): calendar steps count in along:Date ± Period,plusYears(n)(12 * nmonths) andplusWeeks(n)(7 * ndays) never overflow on the way, so an answer past the dates traps naming the date (the date +5881580-08-11 is outside Date.Min to Date.Max), or the count of days where only a day step overflows, as step 2’s traps do; the makersyears(n)andPeriod * n, whose answers are periods, trap as an integer overflow.plusYears,plusMonths,plusWeeksandplusDaystake anint, as the makers do. -
Settled on the user’s delegation 2026-11-11 (built on branch
time-period):Zoned ± PeriodandZoned‘splus…wait for step 3, whoseResolutiondecides a period landing in a gap or an overlap. -
Settled on the user’s delegation 2026-11-11 (built on branch
time-period): the formatter breaks a long one-lineifonly after its lastthen,eliforelse, keeping its tests, its earlier branches and any operators before it on one line. Why: a line after anif‘s test is its block, so a break there changes the program (the formatter refusedlibrary/avin/time/period.avin); a break in an earlier branch would put the nexteliforelseinside a continuation line. Alternatives: wrapping theifin brackets to break inside it (adds tokens, which the formatter never does); leaving any line holding aniflong (also loses the safe break in the last branch). -
Settled on the user’s delegation 2026-11-11 (built on branch
time-parse):BadShapenames what was expected:BadShape(text, at, expected), its messagecannot read "2026/03/08": expected '-' at byte 4, andTrailing‘sexpected the end at byte 10, in place of the chapter’s earliernot the expected shape at byte 4. Why: a reader fixing the text needs to know what would have been accepted there, and the parser knows it at the point it stops. Alternatives:BadShape(text, at)with one fixed message (says where but not what); a separateexpectedmethod computing it again from the text (a second parser). -
Settled on the user’s delegation 2026-11-11 (built on branch
time-parse): a parse reads the whole shape first, then checks the fields in the order they are written, so2026-02-30T24:00is refused for its day and2026-02-30T24:00for its trailing space; a zone name is looked up last. The fields anOutOfRangenames areyear,month,day,date(pastDate.Min/Date.Maxinside their own years),hour,minute,second,fraction,offset,instant(pastInstant.Min/Instant.Max),monthsanddays. Why: one rule for which error a text with several faults gets, and a shape error never hides behind a range error further left. Alternatives: failing at the first fault left to right (a range error could then mask a shape error after it, and the answer would depend on how far the reader had got). -
Settled on the user’s delegation 2026-11-11 (built on branch
time-parse): a year of four digits has no sign, and a signed year has four digits or more, even inside0to9999(+2026,-0000read); an unsigned fifth digit is a shape error at byte 4. A seventh digit of fraction isOutOfRange(text, "fraction")even when it is0.t,z, a comma as the decimal sign,−(U+2212) and a bare±hhoffset are refused. Why: the display never writes them, and each accepted alternative is one more form every other reader of the text would have to accept. Alternatives: ISO 8601’s lowercase and comma variants (wider, and nothing here writes them). -
Settled on the user’s delegation 2026-11-11 (built on branch
time-parse):parseZonedwith a zone name checks the offset against the zone: the reading minus the offset is the instant, and the zone’s clocks must show that offset then, or the text isOutOfRange(text, "offset"); so both readings of an autumn overlap read and a reading in a spring gap is refused. AnyZoneErrorfrom looking the name up (unknown, not a name, an undecodable file) isUnknownZone(text, name). A fixed zone’s name in brackets (+05:30[+05:30],Z[UTC]) reads as the fixed zone. Built overzone(name), which is on dev ahead of the rest of step 3. Why: the offset makes the instant unambiguous, and a text whose offset the zone never shows names no reading of that zone. Alternatives: trusting the zone and re-reading the instant from the reading alone (needs step 3’sResolutionfor gaps and overlaps, and drops the offset the text gave); trusting the offset and ignoring the zone’s (keeps aZonedwhose offset its zone contradicts). Review with the user whether a mismatch deserves a variant of its own rather thanOutOfRange‘soffset. -
Settled on the user’s delegation 2026-11-11 (built on branch
time-parse):parsePeriod(text), named as the chapter’s other readers are, readsP, then a number of yearsY, of monthsMand of daysDin that order, at least one, each with its own-where negative, so everytoIsoString()reads back equal. FormstoIsoString()does not write but whose numbers are plain also read (P12MasP1Y,P0Y,P007D,P-0D); a total of months or days beyond anintis out of range.+,W, aTtime part, a fraction and lower-case letters are refused. Why: a reader for the writer, settled as the step 5 follow-up to thetoIsoString()entry above. Alternatives:Period.parseon the companion (unlike the chapter’s other readers); accepting only the canonical form (refusesP12M, which means one exact period); ISO’s weeks (P2W, fourteen days, whichtoIsoStringnever writes). -
Settled on the user’s delegation 2026-11-11 (built on branch
tls-refusal): why a certificate was refused.TlsError.Certificategains a second field,why: TlsRefusal, andTlsError.refusal() -> Option[TlsRefusal]answers it (Nonefor the other errors).TlsRefusalisHostMismatch,Expired,NotYetValid,UntrustedandOther(code: long), and itsmessage()and the error’s say the reason in words. Amended 2026-11-11 (branchopenssl-024): the mapping to the five kinds comes from the packageopenssl0.2.4, whoseError.refusal()groups the X509 verdicts (62 and 64, a certificate for another name or another IP address, host; 10 expired; 9 not yet valid; 2, 18, 19, 20, 21 untrusted; any otherOther(code)).TlsRefusalmirrorsopenssl‘sRefusaland the privateTlsFailurebindsrefusal()as a mirror’s bound method, so Avin keeps no table of its own; a failure with no verdict isOther(0). Why: a program can tell a wrong name from an untrusted issuer, which read identically before; the reason is a value, so it is matched, not parsed out of text. The field is not anOption, since a refused certificate always has a verdict andOthercarries the unusual ones. The field iswhybecause a variant field namedrefusalwould clash with the method. Alternatives: anOptionfield (aNonethat cannot happen); one variant per kind,HostMismatchand the like asTlsErrorvariants (every existingCertificate(_)pattern would stop matching and a program that only cares that a certificate was refused would need four arms); keepingCertificate(text)and adding a separate query (the reason would have to be stored somewhere anyway). Breaking:Certificate(_)patterns becomeCertificate(_, _). Review with the user whether theCertificatearity change is wanted over a variant per kind. -
Settled on the user’s delegation 2026-11-11 (built on branch
c-binding-gaps-2): A field accessor reads and writes a struct mirror whole: the C unit checks the field is the struct the mirror mirrors (any member path, through pointers and array elements); the reader’s glue copies the field into memory Avin allocates, read into a new value as a filledoutmirror is, the memory then freed; the writer lays the value out as C’s struct and the glue assigns it. A mirror holding a string, directly or in a mirror it holds, is refused as a writer’s value, and anOptionof a mirror is refused either way. Why: FreeType’sface->bboxandface->size->metricsare structs read whole, and one accessor per member (the package’s workaround, eight accessors and a tuple) loses the type; the mirror’s layout is already checked and measured, so the copy is the struct passed by value’s own conversion. Writing a string would leave C holding a copy no one frees, the rule for string fields; a field is never null. Alternatives: read only, no writer (writing is the scalar rule extended and costs one glue function); a writer that leaks or keeps the string copies (C would own Avin’s allocation); answering a handle on the struct inside the owner (lifetime tied to the owner, and every member a call). Review with the user: a mirror holding a string is read-only. -
Settled on the user’s delegation 2026-11-11 (built on branch
c-binding-gaps-2): One pointer to a typedef ofcharis a string: where a string crosses (parameter, result,outvalue, callback parameter), a C type written as one pointer to a typedef (const FT_String *,FT_String const *,T *const) is checked by the C unit as a typedef of the whole pointer:char *orconst char *as a result,const char *as a parameter, so a typedef chain and atypedef const char Tboth work. A pointer to a typedef ofunsigned charorsigned charis refused by a check of its own whose message says those are bytes rather than text, for results, parameters, fields and struct mirrors’ fields. Why: only the headers know whatFT_Stringis, and the existing typedef rule already defers the string check to the C unit; fields already resolved typedefs, since their type comes from the header. Alternatives: rewriting the prototype’s spelling tochar(loses the header check’s typedef names); a new C type kind in the parser for a pointer to a typedef (every handlecairo_t *is one, so each position would have to tell the two apart). -
Settled on the user’s delegation 2026-11-11 (built on branch
c-binding-gaps-2): The c-bindings chapter’s FreeType library is released withFT_Done_Library, notFT_Done_FreeType: the latter frees the library’s memory manager whatever the reference count, so a face kept past the library’s handle would allocate through freed memory. The chapter’s prose and both examples say so. Why: areleasemust give back exactly one reference when the class declaresretain. Alternatives: none that keepskeeps:sound; the manager’s small record is not given back, as the freetype package notes. -
Settled on the user’s delegation 2026-11-11 (built on branch
openssl-024): a mirror’s methods may be bound to Sysl (methods of a mirror). A method without a body in animplof a@sysldata type that names no trait is bound to the Sysl method of its name’s words in snake_case, or the one its own@sysl("name")names, withblockingandnamedas on a handle’s method; it may be overloaded by parameter types; its parameters and result cross as a binding’s do. Each call converts the receiver into the Sysl value, puts it in a counted box of its own and calls the method on that, so a Sysl method takingself,&selfor*selfis bound alike, and what a*selfmethod writes is lost with the box: the mirror is a value. A method without a body on a plain data type, or in animplof a trait, still needs one; a method with a body takes no@sysl. Why:openssl‘sError.refusal()is a method of a struct Avin mirrors, and a mirror had no way to reach it, so Avin copied its table. Theimplform, because a data type’s body holds its variants, and a handle’s body form would need a second kind of body member for data. The box, because the shim cannot see which receiver the Sysl method takes and&selfneeds a counted reference; the cost is one allocation per call. Alternatives: methods in the data’s own body after its variants (a new body grammar for data); a top-level binding whose first parameter is the mirror,@sysl("sh.sysl.openssl.Error.refusal")(a path that names a method rather than a function, read differently from every other binding’s); passing the value on the stack and refusing&selfmethods (most Sysl readers take&self); a*selfmethod’s write copied back (a mirror is immutable in Avin). Also chosen here:TlsRefusalitself mirrorsopenssl‘sRefusalrather than a private mirror mapped to it, since a second data type with the same variant names cannot share the module, and the two would be the same five cases. Review with the user whether a public library type mirroring a package’s enum is wanted: a variantopenssladds must be added toTlsRefusal, which Sysl reports as not matching until it is. -
Settled on the user’s delegation 2026-11-11 (built on branch
stable-names): Each emitted table is named@"avin.<kind>:<name>", the name spelled by qualified names in full, with no hash suffix: a type asavin.Option[int],class geo.Box[],object geo.Box[],(int, string); a descriptor by its type, a variant after its type’s (avin.Option[int].Some); a record by its type; a constant closure by its function; a module-level value by its qualified name (objectbefore an object’s). WHY: readable in the emitted text and in a profile, injective by construction (two types of one module never share a name but an object and its companion, which the prefixes tell apart), and short enough: marshal’s longest symbol is 319 bytes, 275 of its 111,642 symbols are over 200, and every one is local to the program, so no linker or object format limit is near. The emitted text grew 11% (126 MB to 140 MB for marshal). Alternatives: a hash of the spelling (shorter, unreadable, and a collision is silent until the assembler reports it); the spelling cut at a length with a hash of the rest (not needed at these lengths). Emission stops with the name where two of one kind would share one, rather than the assembler reporting a redefinition. -
Settled on the user’s delegation 2026-11-11 (built on branch
stable-names): A string constant is named by the first 16 hexadecimal digits of the SHA-256 of its bytes, a later string sharing them by its index after a dot. WHY: the same string has the same name in every program and every build; 64 bits make a shared prefix within one program improbable past any program’s size. Alternatives: the whole digest (32 more bytes on each of thousands of strings); the text itself (unbounded, and escaping in a symbol). -
Settled on the user’s delegation 2026-11-11 (built on branch
stable-names): A trap site is named by the innermost top-level function or method declared around it, the byte offset from that declaration’s start, and 12 hexadecimal digits of the SHA-256 of its reason; a site in code the compiler wrote (an empty span) by the instance being lowered; one in a declaration the checker copies (a derivedDisplayand its siblings, one method name on several types sharing a declaration) or outside every function by its file and offset. Trap sites are never copied into the units that reach them at-O2. WHY: lines added above a function move its sites’ lines, which only the tables’ unit holds, and leave every function’s text as it was; a copy of a site, which no code reads, would carry its line into the units that reach it. Alternatives: the instance and its sites in order (a site is shared by every instance of a generic function, so its name would depend on which instance was lowered first); file and line (moves with every line added above). Review with the user: a site in a library template is named by file and offset, which an edit to that library file moves. -
Settled on the user’s delegation 2026-11-11 (built on branch
stable-names): A local function or lambda is numbered among its top-level function’s local functions of its name, from 1 in declaration order (<program>.pick.lambda#2). WHY: two blocks may each declare a local function of one name, and the number counts only within the function, which an edit elsewhere never changes. Alternatives: the checker’s symbol index (moves with every symbol declared before it); the byte offset within the function (moves with an edit above the lambda inside the function, which changes the function’s text anyway, and is longer). -
Settled on the user’s delegation 2026-11-11 (built on branch
stable-names): A shared constant object is named by a hash of what it holds, an unshared one (a vector literal’s) by its module-level value and its place among that value’s objects; a C trampoline by its binding and place. WHY: equal shared objects are one object already, so their content is their identity; an unshared object’s identity is its value’s. -
Settled on the user’s delegation 2026-11-11 (built on branch
stable-names): A module-level value that holds a reference keeps its slot in the roots frame, and its name is a private alias of that slot; code names the alias. WHY: the slot’s position moves when a value is added before it, and the alias keeps that position in the tables’ unit alone; the runtime’s view of the frame is unchanged. Alternatives: a global per value and a frame of addresses (a runtime change for the same effect). -
Settled on the user’s delegation 2026-11-11 (built on branch
stable-names): The module-level tables are the last codegen unit ofn, the functions spread over the othern - 1, and a unit holds its pieces in the order of their names. WHY: a new string, type or trap site then changes the tables’ unit and its user’s alone, and a unit whose own pieces are unchanged is the same text whatever order lowering found them in. Alternatives: tables in the first unit that names them (a new early user moves them, changing two units); one unit per kind of table (more units for no fewer recompilations). Left as it was: a function called from one function alone still lives in its caller’s unit, so a second caller in another unit moves it; and a small function copied into its callers’ units at-O2makes an edit to it recompile those units too. -
Settled on the user’s delegation 2026-11-11 (built on branch
manifest-avin-version): a package names the least Avin it builds with (the manifest, the Avin a package needs).avin = "0.0.18"in thepackageblock, a version, met by that Avin and every later one, compared number by number (0.0.9 before 0.0.18). A minimum only: no ranges, no upper bound, no pre-release suffixes. Every package of the resolved graph is held to it, the root and each dependency at any depth, fetched or by path, by every command that reads manifests (build, run, test, check,add,tidy,vendor); a package needing a later Avin is refused at itsavinvalue, naming the package, its requirement and the running version and saying to upgrade, before anything else wrong in that manifest. A malformed value is an error at the value.avin newwrites the running Avin’s version.avin lspreports it onavin.hoconwhen the editor opens one, and on the manifest of the package a file being edited belongs to. Why:caironeeded 0.0.18 and could only say so in its README, and a package that needs a feature should fail with the upgrade named rather than with an unknown key or a type error. The key’s spelling followssysl.hocon, which names the Sysl a package needs assysl = "0.10.0"in itspackageblock. A minimum, because Avin’s versions only add: a later Avin that breaks a package is a bug or a deliberate break in a release, which a range written in advance cannot foresee, and an upper bound would refuse every upgrade until each package re-releases. Checked when each manifest is read, so every path that reads one is held to it without a second walk of the graph; told first, because a manifest written for a later Avin may hold a key this one does not know. Alternatives: a range (>=0.0.18, <0.1), refused for the reasons above; a top-levelavinkey or arequires { avin = … }block (Sysl puts its own inpackage); a warning rather than an error (the build would then fail later and less clearly); checking only the root package (a dependency’s need is the common case, as withcairo). Review with the user whetheravin newshould write the running version (it ties a new package to the Avin that made it, which may be later than the package needs). -
Settled on the user’s delegation 2026-11-19 (branch
min-avin; completes the entry above, which had left the question in § Open): the minimum stays the whole design, the running version is the stampedVersion, and a missing library module points at the upgrade. The key (package.avin), its checking of every package of the graph,avin checkandavin newwere settled and built 2026-11-11; this adds only the hint: the “the standard library has no module” error ends with “if the program was written for a later Avin than this one (X), upgrade Avin, and let its package say which it needs withavin = "…"“. It names no manifest state, because every declared minimum has already been met by the time a module is looked up, so the error means either a typo or a package that does not say what it needs. Dev builds: the version compared is the numberscripts/release.shstamps intoconst Version, three numbers with no pre-release suffix, so a tree between releases is the last release; a package naming a release not yet cut is refused by it with the usual message. Why no exemption: a version has meaning only once a release stamps it, and a pre-release rule would add a suffix to a version syntax that is three numbers.avin tidywarning on a dependency’s minimum above the root’s: not added; the root’savinis what its author tests with, and a dependency above the running Avin is already refused. Alternatives: a hint only where the manifest has noavin(the driver does not see manifests, and the hint is harmless where one is declared); anAVIN_VERSIONoverride for dev trees. Review with the user: the key’s name (avin, aftersyslinsysl.hocon) and whether ranges are wanted (refused above, because Avin’s versions only add). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-keys): An instance key is a content hash in two parts: a lowered part (identity, body fingerprint, interfaces read) and the world facts the whole-program steps decided for it, both made on every build after lowering (the instance key). The facts are recorded where they are decided, as each step runs: the slots of methods with type parameters of their own, each devirtualization decision at a call through a table (not the whole set of descriptors a receiver type admits), and each summary scalar replacement read, with the finished key of every function it inlined (never one that may recur, so the inlined keys form no cycle). WHY: a decision is exactly what a step’s rewriting of a function depends on, so a new implementing class changes the keys of only the calls whose decision it changes, and a callee’s body edit reaches a caller only through a changed summary or an inlining; and the cache (item 6) can reuse a lowered form on the first part and rerun only the passes on the second. Alternatives: the callee’s key for every summarized callee, as the pipeline first wrote it (every leaf edit would reach every transitive caller); the admitted descriptors rather than the decision (a class added past the guard limit would change keys for no change). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-keys): The body fingerprint is per function, with its family’s captures, not per family. A local function or lambda and its top-level function share one table of locals; each fingerprint holds its own tree, the locals it owns or captures, and what every function of the family captures (with each captured local’s type and mutability), which decides what is kept in a box. WHY: a lambda’s body edit then changes the lambda and its closure entry and not the function around it, unless its captures change. Alternatives: one fingerprint for the whole family (every edit in it changes every member; simpler, and what the first build did). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-keys): Places in the fingerprint follow trap-site naming: a node inside its declaration counts from the declaration’s start; a node outside it (a constant default argument copied into a call keeps its place in its own file) is named astrap_namewould name a trap there; a derived impl’s shared template counts from the start of its file; the compiler’s own code (an empty span) is named by the instance. A constant’s place is left out: no trap is named by it. WHY: a trap site’s name is the only place a function’s text holds, so this is the least that keeps the key sound; lines added between declarations change no key. A comment inside a function changes its key whether or not a trap site follows it. Alternatives: only the places of nodes that can trap (needs lowering’s knowledge of which do, duplicated); no places at all (unsound: an edit moving a trap site changes the text). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-keys): What a key reads of types is conservative where the text rarely depends on it: every type argument’s supertypes and method table (they choose the method a call on a bound runs), and a class’s or data type’s whole layout for any read of a field (its field types in order, never the names). So a new impl for a type changes the instances at that type that never call through a bound, and a field appended to a class changes the readers of its earlier fields; both cost a rebuild, never a stale instance. Review with the user if the cache’s hit rate after edits like these matters: narrowing needs the bound calls and the fields read recorded during lowering, as the other facts are. Alternatives: record during lowering exactly which table entries and fields each instance used (precise, more state threaded through lowering). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-keys): The key names the compiler by its version and its executable’s path and modification time, not the level. WHY: lowering does not depend on the level, and the pipeline keeps one instance directory per level. Alternatives: the level in the key as well (redundant with the directory), the executable’s hash (reads 8 MB per build). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-cache): A lowered entry is the instance’s requests and its code by name, replayed; not a record of lowering’s state (the instance cache). Every request lowering an instance makes of the whole program goes through one function of lowering (seventeen of them: a layout, a record, an object’s record, a box, a value box, a type tested, a string, a trap site, an instance, a generated function, a slot, a slot of a method with type parameters of its own, a closure’s shape, a constant closure, a constant object, a call through a table, a call of a function value), which records it while the instance is lowered for the cache; the outermost request alone is recorded. The code names what it counts by its stable name. WHY: replaying a request runs the same code a fresh lowering runs, so the instances, tables and records grow exactly as they would, in the same order, and an incomplete record fails to read back (an unknown name) rather than silently differing. A binding, a C callback and a C binding’s body mark the instance as one no entry holds. Alternatives: the difference in lowering’s state before and after each instance (state is keyed by the checker’s indices, which an edit moves); a module’s whole lowered program (a change anywhere in the module loses all of it). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-cache): Only the program’s functions with bodies get lowered entries. Closure entries, bindings and the functions lowering makes (equality, hashing, rendering, adapters, C callbacks) are lowered every build; every function gets a text entry. WHY: they are small and many of them depend on the whole set of types; on marshal they are about 17,000 of 41,583 instances and a fraction of lowering’s time. Alternatives: entries for every kind (each kind’s requests would need recording; generated functions read tables the worklist is still filling). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-cache): A text entry is keyed by the finished key and the facts emission reads of the whole program: for each call, the callee’s symbol and signature, whether it may collect and whether the call may close a cycle of the call graph, and a shim’s extensions. WHY: these decide the frame, the polls and the calling convention of a function’s text and are not in its finished key, which covers its code. Alternatives: emission facts in the finished key itself (the keys would depend on emission’s call graph); a hash of the finished code (costs an encoding of every function each build). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-cache): The passes still run over every instance on every build; devirtualization’s fixed point runs over per-function summaries (the set of objects a receiver or a result may be) and rewrites only functions that call through a table, and the dispatch sites are found once per position and class or trait. Both give byte-identical text. WHY: measured on marshal, the passes are not where lowering an unchanged instance costs most, and running them only where facts changed needs every function’s post-pass code, scalar summary and fence fact cached under a key over its callees’ (a key over a cone of the call graph, with dispatch targets as edges); that is a design of its own. Review with the user: it is what stands between the cache and a lowering phase proportional to an edit. Alternatives: build the cone keys now. -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-cache): The cache is opt-in in this step:AVIN_INCREMENTAL(on,verify,off) foravin buildandavin emit-llvm, in.avin/build/incremental/<kind><level>/. WHY: item 7 of the plan makesbuild,run,testand the language server use it by default once the corpus has run warm. Alternatives: on by default now. Superseded by the Proposed default for every command that builds (branchincremental-default). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-cache): The store is a file per module named by a hash of its module and keys, with a length and CRC-32 header, a manifest written last, and no lock; a file is kept only if the build read it whole, and files neither named nor used in the last hour are trimmed, with no size limit. WHY: a name from the keys costs nothing to compute (a content hash would hash about 190 MB per build on marshal), the CRC catches truncation and damage, and two builds write the same bytes for the same keys. Alternatives: an entry per file (41,000 files per build); a SHA-256 per file; a size limit as the unit cache has (the unit cache’s hour rule already keeps it to what recent builds used). -
Settled on the user’s delegation 2026-11-11 (built on branch
instance-cache):verifycompares the whole text and names the first function that differs, in the clean build’s order, or the first line where no function does. WHY: the function’s symbol says which key missed a dependency; its key adds nothing a reader can act on. Alternatives: compare instance by instance before emission (needs the clean build’s instances matched to the cached build’s). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-string): String character-wise and parsing methods. Choices the spec did not settle, intypes.md:toBoolis exact. Only"true"and"false";toBooltraps with the number-parse message (For input string: "…") on anything else,toBoolOptionanswersNone. Why: a parse that accepts"True","1"or"yes"hides data errors, and the exact form is the one every program can state. Alternatives: case-insensitive; also"1"/"0".- A
radixoutside 2 to 36 traps, in theOptionforms too. Why: a bad radix is the caller’s bug, not bad input, soNonewould hide it. Alternative:Nonefrom theOptionforms. - Radix digits are ASCII
0–9anda–z, either case, with the optional+/-sign of the decimal forms, and no prefix ("0x10".toInt(16)is not a number). Alternatives: accept a0x/0bprefix where it matches the radix. split(sep, limit):limitis the most pieces; the last holds the remaining text. Alimitof 0 or less means no limit, 1 returns the whole string as one piece. Why: the reading that needs no special negative case beyond “no limit”. Alternatives: a limit of 0 dropping trailing empty pieces; a negative limit trapping.stripLineEndremoves one terminator,\nor\r\n, never a lone\r, agreeing withlines(), which does not end a line at a\reither. Alternative: also a lone\r.compareIgnoreCasecompares the two aftertoLower, asequalsIgnoreCaseequates them, so its sign iscompareof the lower-cased strings. Alternative: comparing character by character after upper-casing.charIterator()is a lazyIterator[char]reading the string by offset, withnext()on an exhausted one trapping like every iterator.map/flatMap/filteron a string answer astring, not an iterator, andtail/inittrap on the empty string asSeq‘s do. Review with the user: whethertoBoolshould be this strict, and whether theOptionforms should answerNonerather than trap for a radix outside 2 to 36.
-
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-ordering):clamp(x, lo, hi)is a free function, andVectorhas noOrdyet. A methodx.clamp(lo, hi)on everyOrdtype needsimpl[T: Ord] T, which the checker refuses (an impl adds to a type parameter only where it is bounded byIntegeralone), soclampis a free function besidemaxandmin, which are free functions too; it traps wherehi < lo. Why: it reads likemax/minand needs no language change. Alternatives weighed: widening the blanket impl rule (a language change with a wide reach); a method onIntegeronly (leaves strings, chars and reals without).impl[T: Ord] Ord for Vector[T]is refused becauseVectoris an abstract covariant class, whose added methods are variance positions, andcompare(other: Vector[T])takesTin;ArraySeqis a final class and has itsOrd.Seq[T]gets nocomparemethod. Review with the user: howVectorshould beOrd. The recommendation is that a method a trait impl adds, and no subclass overrides, is called through the static type rather than the method table, which would makecompareon a covariant abstract class sound; that is a language change, so it waits for the user. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-ordering):Reverse,compareBy,reverseOrderandthenByare inavinas plain names.Reverseis adatatype withOrdreversed and equality asT‘s; descending sorts are written with it rather than asortedDescending(). Why: it composes inside tuple keys, which a descending method cannot. Alternatives weighed:sortedDescending/sortByDescendingonSeq(do not combine with a second key). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-seq): Seq search, slices and combinatorics, collections:searchanswers the first of equal elements.Found(i)is the lowest index holding an element equal to the one searched for, found by a lower-bound halving, so the answer is deterministic. Why: a binary search that stops at the first hit returns whichever duplicate the midpoints reach, which no caller can rely on and a test cannot pin; the lower bound costs the same O(log n) comparisons and makesFound(i)andInsertionPoint(i)one index (iis where the element is or would go, the insertion point of an equal element being its first). Alternatives: any equal element, unspecified (cheaper by at most one comparison, not testable); the last one.search(x, from, until)holds its window to the sequence (untilto0 .. n, thenfromto0 .. until) rather than trapping, as counts are held (take,drop) and unlikeslice, which traps. Why: the window is a bound on where to look, not an index range to read, and an empty or out-of-range one has the clear answerInsertionPointof its edge. Alternative: trap asslicedoes.searchBy(key, wanted)is included (the plan marked it optional); it takes the key function first, assortBy‘s siblingdistinctBydoes, andK: Ord.combinationsandpermutationsare distinct byequalsand ordered by first appearance. The classes of equal elements are found with a hash map on the elements (asdistinctdoes), soequalsandhashmust agree, and the vectors come in dictionary order of the classes’ first appearance. Why: the dictionary order is stepped with O(k) or O(n) work and no memory beyond the class counts, and needs noOrd. Alternatives: the order of a recursive generation, which differs for a multiset; positions rather than values (every permutation of equal elements, n! of them).k < 0ork > ngives an empty iterator,k == 0and the empty sequence’s permutations one empty vector.indexOfSliceandlastIndexOfSlicefind the empty slice where the edges allow: atmax(from, 0)while that is no further than the length, and atmin(end, n)whileend >= 0;lastIndexOfSlice(slice)is the form withendthe length, written as an overload aslastIndexOfis.patchholdsfromto0 .. nand areplacedbelow 0 to 0 rather than trapping, and takesotheras anIterable[W]withW >: T, widening as++does.reduceRightOptionaccompaniesreduceRightasreduceOptionaccompaniesreduce. Alternative for all: trap on an out-of-range count, asslicedoes for indices.inits()andtails()copy the elements into a vector once and slice it per step, so each step is O(log n) and the n + 1 vectors share structure; they are lazy iterators, not a vector of vectors.transpose()of rows of different lengths traps (the plan’s decision), and answers an empty vector, not a vector of empty ones, for no rows; for rows that are all empty it answers empty too.
-
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-math): the integer methods are an inherent impl overInteger, not members of the trait.abs,sign,pow,gcd,lcm,floorDiv,floorMod,bitCount,leadingZeros,trailingZeros,isPowerOfTwoandtoRadixare written once inlibrary/avin/integer.avinasimpl[T: Integer] T, which the core library may declare. Why: it gives every width the methods with no new trait and no change to the closed bound. The cost: a type parameter bounded byIntegersees only the trait’s members, so generic code cannot writex.abs(). Alternatives weighed: putting the methods inIntegeras required members (every width implements them, but “no type implements it” then has an exception, and the arithmetic traits would grow by a dozen); leaving them to free functions (math.abs(x), unlikex.compare(y)). Review with the user: whether generic code should reach these methods, which means making them members ofInteger. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-math): the bitwise and shift operators work on a type parameter bounded byInteger.x & y,|,^,<<and>>on aT: Integerare the machine’s operators at each instance’s width, with both operandsT(x >> T(1)); the checker had treated every operator on a type parameter as a call of a method of that name, soIntegercode had no bit operations at all. Why: the bound is documented as having every integer operation, and the integer methods need them. Alternatives weighed: methodsbitAnd,shiftLeftonInteger(a second spelling of what the operators already say); doing the bit work by division and remainder (slower, and unreadable). ATwith another bound still has them only as methods. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-math): choices inside the integer methods.pow(n: int)takes anintexponent at every width and traps on a negative one (a fraction is not an integer);x.pow(0)is1for everyx,0.pow(0)included.gcdis never negative and traps only when its value isMinValue‘s magnitude;lcmis0when either side is, otherwise positive.signis anint, as arebitCount,leadingZerosandtrailingZeros, which count at the width ((-1).bitCountis32, zero haswidthleading and trailing zeros).toRadixwrites lower case, a-and the magnitude, asf"%x"does, with no prefix, and takesintfrom 2 to 36 and traps outside it. Why: each is the usual meaning, the least surprising for a program moving between widths. Alternatives weighed: alongexponent (never needed; anintis enough for squaring by halves); agcdthat keeps a negative sign (an unsigned-looking result is what callers want). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-math):avin.mathadditions.round(x)returns along, a tie going away from zero, and converts aslong(x)does for NaN and out-of-range values;trunc(x)returns areal, asfloorandceildo, keeping a negative zero’s sign;ulpat the greatest finite value is the gap below it (a finite answer rather than infinity);nextUpandnextDownleave NaN and the infinity they move towards alone. Why:roundis the one the program usually wants as an integer andrintis already therealform; the others follow the platform’s functions. Alternatives weighed:roundreturningreal(no saturation story to tell, but the common use then needslong(round(x)));truncreturninglong(loses negative zero and the large values). Review with the user: theroundandtruncresult types differ, which is unusual to read. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-iterator): The eager methods added to everyIterableanswer vectors.scanLeftis aVector[B],tapEachandconcataVector[T](Vector[W]forconcat[W >: T]),spanandpartitionMappairs of vectors, andflatten()of a collection of collections aVector[T];groupedandslidinganswer theIterator[Vector[T]]a sequence’s do, by delegating to the iterator’s forms. WHY: one predictable kind, the onepartition,spanandscanLefton a sequence already answer, with no higher-kinded types to name the receiver’s own. Alternatives:Iterable[B]as theIterabletransformations answer (hides that it is a vector), or each collection keeping a same-kind form (a long tail of overrides). Review with the user: whethertapEachon a list should answer a list. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-iterator): An iterator’s new lazy forms are added byimpl[T] Iterator[T], not declared in the trait. SopadTo(total, element: T)andzipAll(other, thisElement: T, thatElement)take the element type in a parameter of the covariantIterator, and the forms are found before the eager ones everyIterablehas. An iterator whose static type is onlyIterablegets the eager forms, as withmap. Alternatives: trait members with lower-bounded parameters (padTo[W >: A]), which a program’s own iterator could override, at the cost of a widened result everywhere. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-iterator):it ++ othertakesotheras an ordinaryIterableand asks for itsiterator()only onceitis used up;concaton an iterator is the same lazy join. WHY: a strict argument reads like every other call, and the iterator taken late is what keeps a mutableotherread as it is when reached. Alternative: a by-nameother, which would delay even evaluating the expression. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-iterator):Iterator.fromis two overloads overT: Integer,from(start)andfrom(start, step), not one withstep = 1, since the default would have to beT(1)of the caller’s type. An element is computed when it is read, sofrom(int.MaxValue)givesint.MaxValueand overflow traps only when the element past it is read. Alternatives: a default parameter writtenT(1);intandlongoverloads only. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-iterator): The companion iterators compute when read.fillandcontinuallyevaluate their by-name element at eachnext(),tabulatecallsfat eachnext(),iteratecallsfbefore each element after the first, andunfoldcallsfwhenhasNext()is asked and holds the element it gave. WHY: an iterator does no work for an element that is not read. Alternative:fillandtabulatebuilding a vector and iterating it, as the sequence companions do (eager, andfill‘s element evaluated before any is read). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-iterator):groupedandslidingon an iterator give the windows a sequence’s give, reading the next window whenhasNext()is asked, holding no element beyond the current window, and trapping on a size or step below 1 at the call, with the messages a sequence’s use.BufferedIterator[A]is a public class withpeek()(trapping with “peek on an exhausted iterator”) andpeekOption();buffered()on one wraps it again.flatten()is also on an iterator of collections, lazily, beside the eager one on every collection of collections. Alternatives: windows read atnext()only (no lookahead, buthasNext()could not answer for a step that skips past the end);buffered()answering a buffered iterator itself. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-predef): an impl withoutforadds methods to tuple and function types built from its parameters (impl[A, B] (A, B),impl[A, B] (A) -> B), as the impl chapter already allowed for any type built from parameters and for traits, which function types are. The checker refused both (“an impl adds to a data type, a class, an object or a built-in type”; “an impl for every tuple of an arity implements a trait”); that was a bug against the design and is fixed. The choices the chapter did not settle: a function type’s methods reach the types that are subtypes of it (a data type or class naming it, sequences, sets, maps, partial functions), as a trait’s added methods reach its implementers, and the type’s own method of the same parameter types is found first, as for a trait; a tuple pattern stays exact, as other non-trait patterns do. A@sendablefunction type in the pattern matches only@sendablefunctions. Such an impl outside the core library is an extension, since the tuple and function types are the core library’s. Rationale: these follow the existing rules for traits and for patterns, with no new rule. Alternatives weighed: matching only receivers whose static type is a function type (aVectorwould then lackandThen, though it is passed wherever an(int) -> Tis); treating a@sendablepattern as plain (its methods would reach functions that may not run on another thread, against what the impl names). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-predef): an impl naming a tuple or function type has at least one type parameter.impl (int, int)with none begins a function namedimpl, sinceimplis a keyword only before a type andimpl(…)declares a function;impl() -> intfollowed by a body reads either way, so no rule on the tokens can tell them apart. A part may be written out (impl[A] (A, int)). Alternatives weighed: allowingimpl[](an empty list says nothing and the parser refuses it for every impl); makingimpla full keyword (breaks a function of that name). Review with the user: whether an impl for one concrete tuple or function type is wanted enough to reserveimpl (. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-predef):require(condition, message)takes the message by name, so it is built only when the requirement fails, whileassert(condition, message)takes a plain string. Rationale:requiresits at the top of ordinary functions, called on every call, and its message usually interpolates the arguments; building it every time would cost the common path. Alternatives weighed: a plain string, asassert(cost on every call); changingassertto by-name as well (out of this item’s scope; it would be a separate change to a settled API).todo(message)takes a plain string, since it always traps.ensuringis not provided: it needs an impl for every type (impl[T] T), which only the integer family has; a postcondition is written withrequire/asserton the result. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-inplace): in-place operations onBuffer,DequeandArray, andStringWriterlength and clear. Choices the spec did not settle: (1)remove(i, n)is an overload ofremove(i), and its count parameter is namedn, so it never shadows the buffer’s owncount. A range not within the collection traps (ngreater thanlength() - iincluded, tested without overflow);n = 0atlength()is allowed. (2)subtractOne(x)answers abool(whether one was taken out) rather than the collection, and is declared in animpl[T: Eq]block, so it exists only where elements compare; it takes the first match, from the front. Alternatives: returningselffor chaining (hides a miss), and a-=operator (a bool-valued compound assignment reads badly). (3)filterInPlaceandmapInPlacetrap when the predicate or function changed the length, instead of leaving the outcome unspecified or silently working on a snapshot: the check is one comparison per element and turns a corrupted result into a trap at the caller’s line. Alternatives: iterate a snapshot (hides the bug and costs a copy), or leave it undefined. (4)mapInPlacetakes(T) -> T, since the element type cannot change in place. (5)patchInPlace(from, other, replaced)readsotherfirst and traps for afromorreplacedoutside the collection, where a clamping rule would hide a wrong index. (6)fillInPlaceis a separate name from the companion’sArray.fill, asfillthere makes a new array; it shares the one value asfilldoes. (7)Array.copyTo(dest, at, from = 0, count = length() - from)givescounta default that is a function offrom, which the declaration rules allow; it is overlap-safe in both directions (the copy runs backwards whendestis the same array andat > from). All ranges are checked before the first element moves. (8)StringWriter.length()is anintcount of bytes, as every offset into a string is, andclear()drops the stored text so a text already taken is unaffected. Awrite(x: Display)overload onWriteris not added: it would sit besidewrite(text: string)(astringisDisplay) and make every call a resolution by specificity for no gain,writeDisplayedalready writing anyDisplayvalue. Revisit if a user wantsout.write(42). Review with the user: the length-change trap in (3), and leaving outwrite(x: Display)in (8). -
Settled on the user’s delegation 2026-11-11 (built on branch
neg-nan-sign): Unary minus on arealflips the sign bit of every value, NaN included (the machine’s negation, not-0.0 - x, which leaves a NaN’s sign as it was), andmath.signBit(x: real) -> boolanswers whether the sign bit is set, so the sign of a NaN or a zero can be observed. WHY: negation is the sign flip for every value in IEEE 754, and withoutsignBita program could tell a NaN’s sign by no means (hashmakes every NaN one value and both print asNaN). Alternatives: reading the sign throughcopySign(1.0, x)only (works, but reads as a trick). -
Settled on the user’s delegation 2026-11-11 (built on branch
union-mir-words): Values of more than one machine word in the intermediate code (the first part of the union tag-and-payload layout, under Settled → unions → Representation).- Each word is a value of its own (scalar replacement): as parameters a multi-word value is one
parameter per word, in a local one slot per word, in an object or a closure one field per word,
and a merge at a join is one slot per word. Only a result needs new forms: a signature’s
restlists the types of the words after the first; a call defines the first word as its value and each later one withCallWord, a return gives the first as its value and each later one withReturnWord; LLVM returns the words as one structure, in registers. Why: every word is an ordinary typed value, so the frame plan roots exactly the words of reference type, wherever each is live across a collection point, and never a scalar word, with no change to how roots are found. Alternatives: an LLVM structure value carried whole (the root plan would have to look inside it); returning the later words through slots of the caller passed by address (a slot whose address is passed is no root the plan follows); returning them through the thread’s context (a store and a load per word, and a window where a reference is in no frame). - Proven on tuples taken apart from calls:
val (a, b) = f(x), wherefis one of the program’s functions with a body (not a constructor, a trait’s method or a binding) and the tuple has at least two parts with runtime values, calls a copy off,f#words, that answers with the tuple’s parts, one word each; every return reads the parts out of the tuple, which is then made and read in one function and kept as its parts, and a call in tail position of a function yielding a tuple of the same words passes its words straight on. So a recursive or large function answering with a tuple no longer allocates it for a caller that takes it apart; a caller that keeps the tuple callsfitself, which still makes it. Why: a real path the existing programs run, with references beside scalars in every combination, and with no change to any type’s representation or to what a program sees. Alternatives: a compiler-internal pair type no program could reach (exercised only by tests); every function yielding a tuple answering with words and callers that keep it making it again (a made-again tuple’s type record could differ from the one the function made, which a type pattern on anAnywould see). - A small function answering with words is inlined where it is called, each later word through a
slot of its own, so
val (q, r) = divmod(a, b)still makes no call and no tuple. Guarded calls through a method table meet in one value, so devirtualization leaves a call of several words through the table rather than guarding it. A call in tail position whose every word the block returns at its own place is a tail call, its whole result returned, so functions answering with words call each other in constant stack as functions yielding tuples do. Alternatives: never inlining such functions (a call where there was none at-O0); no tail calls of several words (deep mutual recursion throughval (a, b) = f(x)would overflow the stack).
- Each word is a value of its own (scalar replacement): as parameters a multi-word value is one
parameter per word, in a local one slot per word, in an object or a closure one field per word,
and a merge at a join is one slot per word. Only a result needs new forms: a signature’s
-
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-priority-queue):PriorityQueuegives the greatest element first (branchstdlib-priority-queue), collections.PriorityQueue[T]()orders byT‘sOrd, andPriorityQueue.withOrdering(compare)by a comparison; the elementcomparefinds greatest comes out first. Why: it matchesmax, which everyOrdtype already answers, anddequeuethen takes the same elementmax()would; a least-first queue is oneReverseorreverseOrderaway either way. Alternative: least first (the order of a sorted sequence read from the front, the usual choice for shortest-path searches); it makesPriorityQueue[int]()the odd one out againstmax. Review with the user: it is the default every caller will meet. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-priority-queue): A queue’siterator()andtoVector()are in heap order, andtoSortedVector()is the sorted form (branchstdlib-priority-queue). Heap order starts with the greatest element and is otherwise unspecified; the iterator is a snapshot taken when it is made, so enqueuing or dequeuing while iterating neither traps nor changes what it gives. Why: heap order costs nothing, a sorted iteration costs O(n log n) and a copy, andIterableconformance wants the cheap one; a snapshot makes mutation during iteration defined. Alternatives: iterating in dequeue order; an iterator over the live heap (cheaper, but what it gives after a change is arbitrary). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-priority-queue): Equal elements come out in no promised order (branchstdlib-priority-queue): a binary heap is not stable. Alternative: a sequence number breaking ties first-in-first-out, at the cost of a word per element and a wider comparison; a caller wanting it orders bythenByon its own counter. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-ordered-map): Insertion-ordered maps and sets: names, update order, equality (branchstdlib-ordered-map). The concrete types areOrderedMap[K, +V]andOrderedSet[A], conforming to the traitsSeqMap[K, +V]andSeqSet[A]. Why: the concrete names say what the collection does, asHashMapsays how it finds andTreeMaphow it sorts, and no implementation (a vector of keys) leaks into them; the trait names follow the sequence-like “in the order added” meaning ofSeq. Alternatives:VectorMap/VectorSet(names the layout, not the behaviour),InsertionOrderedMap,LinkedHashMap-style names, andOrderedMapas the trait with the concrete type named for its layout. Update order: updating a key already present keeps its place and replaces its value; removing and re-adding moves it to the end. Why: an update is not a new arrival, so a map used as a record keeps its field order. Alternative: an update moves the key to the end. Equality: two maps are equal when they hold the same keys bound to equal values, and two sets when they hold the same elements, whatever the order, and equal ones hash alike, so anOrderedMapequals aHashMapof the same entries as every kind ofMapdoes. Why: the existing rule makes map equality independent of the kind, and an order-sensitive==on one kind would break transitivity through the traits. Alternative: an order-sensitive==between two ordered maps (reached by comparingiterator()s). Layout: a hash trie from key to slot and a vector of slots, removal leaving a gap, compacted when gaps exceed both eight and the entries.map,collectandflatMapthrough the trait answer hash-based collections, as forTreeMapthroughMap. A{k: v}or{a, b}literal builds one whereSeqMap,OrderedMap,SeqSetorOrderedSetis expected. Review with the user: the names. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-ordered-map): A call through a method table or a bound reaches only methods of types that conform (branchstdlib-ordered-map; a fix, recorded because it changes what the polymorphic-recursion check reports). The type arguments of a method’s own type parameters flowed into every method of the same name and arity of any type, so a generic method that called a sequence’supdatedwith a type built from its own parameter was reported as recursing into itself. They now flow only into methods of types that have the called method’s class or trait among their ancestors. Alternative: keep the name-only approximation and rename the method (rejected:updatedis the name every map has). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-linked-map):avin.collections.mutable.LinkedMap[K, V]andLinkedSet[A], the insertion-ordered mutable map and set. The choices:- Re-binding a present key keeps its place;
putLast(k, v)andmoveToEnd(k)(and a set’saddLastandmoveToEnd) make it the newest, and a key removed and bound again is new. Why:m(k) = vis a plain update everywhere else, and an insertion-ordered map whose update reorders it would makem(k) += 1shuffle the iteration; an LRU cache that wants the move says so withmoveToEnd. Alternatives: every put moves to the end (access order for caches, but surprising for a plain map); a constructor flag selecting access order (one type with two behaviours). - Equality and hash ignore order: two linked maps (or sets) are equal when they hold the same
entries, as two mutable maps are; a
LinkedMapis not comparable with aMapof the other kind (they are different classes). Why:==on maps is about contents, and the order is observable through iteration anyway. Alternative: order-sensitive equality, which makes{a: 1, b: 2}differ from{b: 2, a: 1}, unlike every other map. - The oldest and newest ends:
headOption()andlastOption()answer the ends in constant time (overridingIterable‘s, sohead()andlast()trap when empty), andremoveFirst()andremoveLast()answer the removed(key, value)(a set’s, the element) and trap when empty. Why:removeFirstis the eviction step of an LRU cache. Alternatives:removeFirstanswering anOption(an empty map is then silently ignored by a cache that expected an entry);pollFirst-style names. - Mutation during iteration: replacing values and removing entries are defined (a removed entry the iterator has not reached is skipped); binding new keys never traps but whether the iterator visits them is not defined. Why: the entries sit in a buffer, a removal leaves a gap the iterator skips, and the buffer is squeezed only by an insertion, which hands the map a new buffer and leaves an iterator in progress stepping through the old one. Alternative: trapping on a structural change (a version counter), which the other mutable maps do not do either.
- Representation: a
Map[K, int]from each key to its position, and aBufferof entries in insertion order with gaps for removed ones, squeezed when gaps are half of at least 32 positions; every operation is amortized constant time. Alternative: open addressing with order links threaded through the table, one structure instead of two but a second copy of the table’s removal logic; it can replace this without changing the API.
- Re-binding a present key keeps its place;
-
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-queue):Queue[+T](immutable, two lists), built by the stdlib-queue branch.- Choice:
Queueis an abstract covariant class with a private two-list implementation, so its constructor cannot be called with a state that breaks the invariant (the front is empty only when the back is). It hasQueue(xs*),Queue.empty[T]()andQueue.newBuilder, but notabulateorfill, no++, and no literal form.dequeue()answers(T, Queue[T]);front()is the name of the head read;apply(i)is O(i) andmap/filteranswer queues. - Why: the abstract class keeps the invariant that gives constant-time
front()and amortized constantdequeue; a pair return keeps the type immutable;Seqconformance gives equality, hashing and the sequence methods for free, so a queue equals a vector of its elements. - Alternatives weighed: a
datatype with publicCons-like variants (exposes the lists and the invariant); a banker’s queue with lazy rebalancing (worst-case bounds, but heavier and no better for the usual single-threaded use);dequeueansweringOptiononly (loses the trap that every otherremoveHeadhas);head/tailnames only (they remain, fromSeq, withtailanswering aVector).
- Choice:
-
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-bitset):BitSet(immutable and mutable): representation and negatives (branchstdlib-bitset). Proposed: the immutableBitSetis a class over aVector[long]of words, kept without empty words at the end, so an update copies one path andtoBitMask()is the words; the mutable one is over aBuffer[long]. A negative element is not in any bit set:containsandexcl/removetreat it as absent (false, set unchanged), and everything that would add one traps (incl,++,apply, the builder,add,+=,++=,addAll); the ordered queries and slices take anyint. Why: a query about a number that cannot be present has the honest answer “no”, which keeps generic code overSet[int]from trapping ons(x), while storing a number the set cannot hold must not silently succeed. Alternatives weighed: trapping incontains/removetoo (strict, but breaksSet[int]code that probes with arbitrary ints); ignoring negatives inincl(silently drops an element, sos.incl(x).contains(x)can be false); offsetting by a minimum (a different set type). Review with the user if bit sets of negatives (a signed range) are wanted. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-bitset):BitSetmethod names beyond theSetones (branchstdlib-bitset). Proposed: the immutable set addssymmetricDiffandtoBitMask, withBitSet.fromBitMask; the mutable one addsunionInPlace,intersectInPlace,diffInPlace,symmetricDiffInPlace(taking a mutable bit set), the non-mutatingunion,intersect,diffandsymmetricDiffover mutable bit sets,copy()andtoSet()(the immutable one), beside the mutableSet‘sadd,remove,addAll,+=,-=,++=,--=andfilterInPlace. Why: the…InPlacesuffix names the in-place form of a method the set already has (asfilterInPlaceandsortInPlacedo) and spells out what the symbol forms|=and&=would, which are free method names but carry no word for a reader. Alternatives:|=,&=,-=as the in-place algebra (-=is taken by removing an element);unionWithand so on (suggests a combining function);addAll(other)for the union (already means adding elements of anyIterable).symmetricDiffisxorin some libraries; the longer name reads without knowing bit-twiddling. The mutable bit set’sunion/intersect/difftake a mutable bit set only rather than anySet[int], the mutableSetnot being aSettrait member either. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-bitset): A mutableBitSetiterates over a snapshot, and its ordered queries copy it (branchstdlib-bitset). Proposed:iterator(),headOption(),lastOption(),minAfterandmaxBeforeof a mutable bit set read an immutable copy of its words, so changing the set during aforis safe and visits the elements it had when the loop began. Why: it makes the iterator the same code as the immutable one, and a mutable hash set’s iterator has no defined behaviour under change at all, so a stable one is the safer promise. Cost: one pass over the words per call, so a loop callingminAfterrepeatedly on a large sparse set is quadratic in the words. Alternative: a live iterator that reads the words as it goes (no copy, but sees its own changes); revisit ifminAfteris used as a scan. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-mutable-tree): A mutable tree map or set holds an immutable one and replaces it; iterating it while updating it is legal and sees the collection as it was.avin.collections.mutable.TreeMapandTreeSetkeep a private immutableTreeMaporTreeSetand assign a new one at each update. Why: the persistent tree is already balanced and tested, itsSortedTreeis private to moduleavin(so a second module could not share it without widening it), every ordered query comes for free, andtoTreeMap()/toTreeSet()become O(1) snapshots. Consequence: an iterator made before an update visits the entries as they were, so a loop that removes or adds entries cannot skip, repeat or fault, unlike the hash-based mutable collections, whose iteration while updating is unspecified. Alternatives weighed: a mutable balanced tree with in-place rotations (faster constants, no allocation per update, but a second tree implementation, and iterators would need invalidation rules); a skip list (same objection). Updates allocate O(log n) nodes, which a mutable tree would not; revisit if a profile shows it. Review with the user: the snapshot-iteration guarantee is a promise a later in-place tree would have to keep. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-mutable-tree): Two types are namedTreeMap(andTreeSet), one inavinand one inavin.collections.mutable. AsMapandSetalready are. Inside the mutable module the bare name is the mutable one and the immutable one is imported under an alias; a program importing the mutable one unaliased while also using the prelude’s gets the mutable one for the bare name, and reaches the immutable one through an aliased import (both forms are tested). Alternatives: distinct names (MutableTreeMap) which would break the parallel withMap/Set. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-mutable-tree):removeFirst()/removeLast()trap on an empty collection;removeFirstOption()/removeLastOption()answerNone. The immutable sorted collections pairhead()(trapping) withheadOption(); the removal operations follow the same split, the plain name being the trapping form. Alternatives: answering anOptionfrom the plain name (asremove(key)does), or apollFirstname. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-mutable-tree): Therange*forms of a mutable tree collection answer a new mutable collection, not a view. Asfilterandcopy()do on the hash-based mutable collections; a write to the slice does not reach the original. Sharing the tree makes the slice O(log n) to make. Alternative: live views, which would need the mutable tree to be in place. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-mutable-tree): A mutable tree set’sunion,intersect,diffandsubsetOftake a mutable tree set, as the mutable hash set’s take a mutable hash set; thekeySet()of a mutable tree map is an immutableTreeSetsnapshot, as a mutableMap‘s is an immutableSet. -
Settled on the user’s delegation 2026-11-11 (built on branch
tuple-result-override): an override’s or an implementation’s result may be any type seen as the declared result with no conversion (declarations), the covariant position generics already names:-> (Dog, Dog)overrides-> (Animal, Animal),-> (HashMap[K, V], HashMap[K, V])implements-> (Map[K, V], Map[K, V]),-> Option[Dog]overrides-> Option[Animal],-> () -> Dogoverrides-> () -> Animal, and-> stringoverrides-> Any. A result that would need a box (-> intfor-> Any,-> (int, int)for-> (Any, int)) or that differs at an invariant argument (Array[Dog]forArray[Animal]) is still refused. Rationale: the chapter said “for a class, a subclass”, which refused exactly the shapes the variance rules call subtypes with one representation, so a value returned through the base needs no conversion; the checker now asks the same no-conversion question an element of a covariant collection does. Alternatives weighed: keeping results to classes only (tuples and covariant instances then need a differently named method, as own-kindpartitionmet); also boxing a scalar result, which would make an override’s call site convert behind a virtual call. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-lazy-list):LazyList[+T]is a class whose cell is a privatelazy val, and the expression that computes the cell is dropped once it has run. The cell isOption[(T, LazyList[T])]; the class holds a function that reads the real expression out of a captured variable and empties it, so an evaluated cell keeps nothing the expression captured. WHY: a covariant class may hold novarof its element type, and alazy valis the one immutable field that is computed once and kept, with its trap on a read during its own evaluation. Keeping the expression would hold everything it captured for as long as the cell lives (afiltercell would hold every source cell it skipped). ALTERNATIVES: an invariant node class withvars (the list could then not be covariant); avarof typeAnycast back on each read (no type checking of the cell); keeping the expression (simpler, a space leak). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-lazy-list):LazyList.cons(head, tail)takes the head strictly and the tail by name, and the tail is evaluated when the list’s second cell is first read, not when the first is:xs.headnever evaluates the tail expression. WHY: the first cell is then exactly the head, and a function building a list recursively runs one step per cell read. ALTERNATIVES: a by-name head too (a cell would then be one more function for a value usually at hand); evaluating the tail with the first cell (one list fewer per cell, buthead()runs the next step). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-lazy-list, replaced on branchlazy-cons-operator):x +: xsprepends to a lazy list already made, andLazyList.cons(x, tail)is the delayed form. The user then decided (2026-11-11): “yes, a lazy head #:: tail operator would be good to include.” The operator is the entry below;+:stays strict. -
Settled on the user’s delegation 2026-11-11 (built on branch
lazy-cons-operator): A companion object may declare an operator ending in:with its right operand by name, andx op: rcalls it wherer‘s type is the companion’s type.object LazyListdeclares#::[T](head: T, tail: -> LazyList[T]), so0 #:: 1 #:: fibs.zip(fibs.tail).map((a, b) -> a + b)evaluates its tail only when the cell after the head is first read. The right operand’s type decides whichop:is called, and that type is known only once the operand is checked, so wherever some companion declaresop:this way, the right operand of everyx op: ris checked as a delayed expression; a type whoseop:is its own strict method evaluates it once at the call, afterx, as before. A type with its ownop:whose companion also declares one makes the call an error naming both. Where the call is expected to give a type whose companion declares the operator, the right operand is checked against that type (val xs: LazyList[long] = 1 #:: 2 #:: LazyList.empty()takeslongliterals). WHY: it reuses two rules the language already has, a companion holding what belongs to a type and by-name parameters with all their restrictions, and adds no declaration syntax; the operator reads as the list it builds, and nothing changes for operators no companion declares so (+:,::,:+). ALTERNATIVES: a by-name receiver for a method (selfa delayed expression: no value to dispatch on, a new declaration form, and every bare member read in the body would evaluate it again); alazymodifier on a method (reads as a memoized result);::building a lazy list where one is expected (overloads the language’s ownListoperator on the expected type); a special case forLazyListin the checker (not available to other types). Review with the user: the cost of the rule is that areturn,breakorcontinueinside the right operand of#::is an error on every type, sinceLazyListdeclares#::for the whole program. -
Settled on the user’s delegation 2026-11-11 (built on branch
lazy-cons-operator):#is an operator character, and a leading#is passed over when a symbol name’s level is decided:#::binds as::,#+as+, a name of#alone (##) binds tightest, and a single#is no operator. WHY:#::must bind more loosely than arithmetic (n + 1 #:: rest), and a#prefix marks a variant of an operator without changing how it reads.#was unused in code before, so no program changes meaning. ALTERNATIVES:#at the tightest level as other unclaimed characters are (thenn + 1 #:: restwould ben + (1 #:: rest));#its own level. This replaces the earlier note that#is no operator character, which keptavin.processfrom spelling#|; those combinators keep their word names. -
Settled on the user’s delegation 2026-11-11 (built on branch
lazy-cons-operator): There is nohead #:: tailpattern. A pattern names an extractor by a word (Name(p1, p2)), and the only operator written between a pattern’s parts isList‘s::, so an infix extractor pattern would be a further language change. A lazy list is taken apart withheadOption()andtail(). Review with the user if infix extractor patterns are wanted. -
Settled on the user’s delegation 2026-11-11 (built on branch
lazy-cons-operator): A lazy list’s cell read while it is being evaluated traps witha LazyList cell is read while it is being evaluated, checked by a flag the list’s progress record holds while its cell’s expression runs, rather than thelazy val‘s own message, which named the private fieldcell. ALTERNATIVES: keeping thelazy val‘s message (names an implementation detail). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-lazy-list):LazyListis anIterable, not aSeq. WHY: aSeqanswerslength(),apply,lift,isEmpty,==and its hash throughlength(), which never returns on an endless list, and every eager method aSeqadds would build aVectorfrom it; sequence patterns over it would calllength()too. As anIterableit keeps the forcing methods every collection has, its own lazy forms found first. ALTERNATIVES: aSeqoverriding the methods that would not return (most of them), or aSeqwhoselength()simply does not return on an endless list. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-lazy-list): A lazy list’sDisplayandDebugshow the evaluated prefix and…, evaluating nothing:[0, 1, 4],[0, 1, …],[…], with a field width padding the whole. WHY: displaying an endless list must return, and a display that evaluated cells would run a program’s functions while printing. ALTERNATIVES: forcing every cell (does not return on an endless list); a fixed prefix forced (side effects while printing);<not computed>text (longer, and not a form the other collections use). NoEq,HashorOrd, which could not answer for two equal endless lists. -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-lazy-list): A lazy list is not sendable, so each belongs to the thread that made it; the cells’lazy valevaluation would be safe between threads, but the expressions not yet evaluated are functions that may capture anything. ALTERNATIVES: sendable when every expression is a@sendablefunction (every lazy method would need a sendable form). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-lazy-list):ziptakes anotherLazyListand stays lazy;flatMaptakes(T) -> Iterable[U], reading each collection through its iterator as cells are read;++takes its right operand by name, evaluated only when the cell after the left’s last is read (the iterator’s++takes a strictIterable, since an iterator is read once anyway);toLazyList()on everyIterableconverts, sincefromis the integer counter’s name as onIterator. Also added beyond the item:filterNot,zipWithIndex,fill,tabulate,lift,force()andisEvaluated(). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-map-extras): Map defaults, own-kindpartitionandSet.subsets(branchstdlib-map-extras). Proposed:withDefault(f)andwithDefaultValue(v)on every map answer aDefaultMap, a wrapper whoseapplyof an absent key answers the default and whose every other read (get,contains,getOrElse,size, iteration,keySet) sees only the real entries; the default is never stored.updated,removed,++,--,updatedWithandfilterkeep the wrapper and its default;transformandmapValuesanswer the wrapped map’s own kind, because a default of the old value type cannot be carried across the function. The wrapper equals, and hashes as, the map it wraps and every map of the same entries, ignoring the default. A default of a supertype widens the map, asupdateddoes. Why:getansweringOptionis how a program asks whether a key is there, and a counter wantsapplyalone to be total. Alternatives weighed:getalso answering the default (hides absence, makescontainsandgetdisagree); the default taking part in equality (two maps of the same entries would differ by a closure that cannot be compared); the wrapper mapping its default throughmapValues(needs the value function to be applied to a default on every miss, a surprise at each read).partitionof a hash, tree or ordered map and of a hash, tree, ordered or bit set is a method of the concrete type answering that type,pcalled once per element; it is not onMap,Set,SortedMap,SeqMap,SortedSetorSeqSet, so through a trait a set’s partition isIterable‘s and answers vectors, as the settledIterabledecision says, and a map’spartitionof a pair function answers the own kind only where the type is known. Why: a tuple of two collections is not a subtype of a tuple of two supertypes in an override’s result, and a set’s partition over the trait cannot changeIterable‘s result type. Amended on the user’s delegation 2026-11-11 (built on branchpartition-override): with an override’s result free to narrow,Map,SortedMapandSeqMapdeclarepartition(p: (K, V) -> bool)answering maps of their own trait (Mapcarries a default built onremoved, so a user class implementingMapneeds no change), and each concrete map overrides it with its own kind, so a call throughMapanswers maps of the receiver’s kind. Sets keepIterable‘s(Vector, Vector)throughSet, since a set is not a vector andSetcannot narrow it; the own-kind setpartitionstays on the concrete types. Alternatives weighed: aSet.partitionanswering(Set, Set)(conflicts withIterable‘s result, which is not a supertype of it). Alternatives weighed originally: trait methods answering(Map, Map)(the concrete type then could not narrow the result); twofiltercalls (callsptwice, which a predicate with an effect shows).subsets()andsubsets(k)are iterators onSetthat read the elements into a vector and generate combinations by size, so the order is by size then by position and nothing is made ahead; every subset is a set of the receiver’s kind. Why by size: the empty set first and the set last, the same order for every kind, and no2^ncounter to overflow for a set of more than 62 elements. Alternatives weighed: bitmask order (overflows past 62 elements, and puts the subsets in an order a reader cannot predict from the sizes). -
Settled on the user’s delegation 2026-11-11 (built on branch
stdlib-from): Companionfrom,Vector.iterate,unfoldand the sorted conversions (branchstdlib-from). Proposed:from(xs: Iterable[T])on every immutable collection companion and on the mutable ones (Buffer,Map,Set,TreeMap,TreeSet,LinkedMap,LinkedSet,BitSet,PriorityQueue), a map’s takingIterable[(K, V)]; for a duplicate key the later pair’s value wins (an ordered map keeping the key’s first place), the ruleapplyand the builders already follow.Vector.iterate(start, length, f)takes the length as its second parameter and callsflength - 1times;Vector.unfoldandList.unfoldare the eager forms ofIterator.unfold.toSortedSet()andtoSortedMap()areimplblocks onIterablebounded byOrd, liketoSet()andtoMap(). Why: one spelling that works for every source and target, where the collection-specific conversions need a method per pair. Alternatives weighed: ato(factory)conversion (needs higher-kinded types); a universalinto(builder)(not added:builder.addAll(xs)already reads as well, andfromcovers the target-first reading);List.iterate/ArraySeq.iterate(not added;Vector.iterate(...).toListis one call);Array.from(left out as arrays are not in the item).Iterator.from(start)is the unrelated counting iterator and keeps its name. -
Settled on the user’s delegation 2026-11-11 (built on branch
union-tag-payload): The words of a union with a scalar member, and where they live (the second part of Settled → unions → Representation, built on the multi-word values above).- Three words: a 32-bit tag, 64 bits for a scalar member and, where a member is a reference, the
reference. Tag 0 says the union holds a reference, whose header names its type; tag
i + 1says it holds scalar memberi, the scalar members ordered by their type keys, so the order written never changes the layout. A scalar is kept in the bits as its value: an integer sign-extended, abyteand acharzero-extended, aboolas 0 or 1, areal‘s bits unchanged (so a NaN’s payload and a zero’s sign survive),unitas nothing. A union of scalars alone has two words. Why: the reference word is the only one the frame plan can root, and a separate 64-bit word holds every scalar unchanged. Alternatives: one word for the tag and the bits together (alongmember needs all 64 bits); a word per scalar member (more words for nothing); numbering by the order written (int | stringandstring | intwould differ). - In lowering, the union is a reference to its cell, an object of those words that is made once
and only read; a function takes and gives each union as its words (
MCellin a signature, replaced by the words before anything else reads the program), and makes a cell of the words it receives. So scalar replacement keeps every cell of a local, a parameter or a result as its fields in slots, and none of them allocates; a call in tail position passes its callee’s words straight on. Why: every operation on a union (injection, amatch,==, the hash, rendering) is written once, on the cell, and the existing scalar replacement makes it words everywhere a value stays in its function. Alternatives: lowering carrying several operands for one value through every expression form (a much larger change to every join, local and call path, for the same code after scalar replacement). - Where a union is stored (a field, an element, a capture, a module-level value, a generic
type’s storage at a union argument), its cell stays an object, traced through its reference
word, until those places lay a union out as its words too: storing a union allocates its cell as
boxing a scalar did, a string member included. Why: one representation per type everywhere, so
generic code at a union type argument needs no conversion where it meets its storage.
Alternatives: converting to an
Anyat every such boundary (a box only for a scalar member, but a conversion at every generic call and field access, each a place to get wrong). Superseded by the next entry (branchunion-words-storage): storage now holds the words. - Converting to an
Anyor a trait boxes a scalar member there and passes a reference member as it is; a member call through a trait every member has converts the union the same way, exceptdisplay,debugandtoString, which call the member’s own implementation by the tag with no box.===with an object compares the union as anAny, so a scalar member, a new box, is never identical to it.==and the hash are decided by the tag: two values of one member compare and hash as that member, and a reference as anAny, so a union and the same value as anAnyare equal and hash alike. Review with the user: storing a union with a string member now allocates its cell where anAnydid not, until fields and collections take the words.
- Three words: a 32-bit tag, 64 bits for a scalar member and, where a member is a reference, the
reference. Tag 0 says the union holds a reference, whose header names its type; tag
-
Settled on the user’s delegation 2026-11-11 (built on branch
union-tag-payload): Tuple type patterns by their parts’ layouts.Anyare equal and hash alike. (The review flag this entry carried, a stored union with a string member allocating its cell, is closed by the next entry.) -
Settled on the user’s delegation 2026-11-11 (built on branch
union-words-storage): A union with a scalar member is stored as its words (the storage half of the entry above).- Every storage place holds the words: a field of a data value, a class or a tuple, an array
element (so a
Vector, aBufferand a map), a closure’s capture, a capturedvar‘s box and a module-level value lay the union out as its tag (in an 8-byte slot), its bits and, with a reference member, its reference, 24 bytes or 16, and only the reference word is traced (a descriptor’s reference offsets, an array’s element map). Storing reads the words out of the value’s cell; loading makes a cell of the words read, which scalar replacement removes, so storing and reading allocate nothing for any member. Why: it removes the allocation the entry above flagged, and every place reuses one pair of helpers. Alternatives: the cell kept as an object in storage (an allocation per store, a string member included); converting to anAnythere (a box for each scalar member, and type tests on read). - Generic code at a union type argument stores the words in each instance (
Vector[int | string]holds 24-byte elements), never boxing at a generic boundary. Why: generic code is compiled per instance already, so the instance’s storage is the union’s own; nothing converts at a call. Alternatives: boxing a union to anAnywhere it enters generic code (an allocation per element and a type test per read, for no gain). - A module-level union keeps its tag and bits in its own 16 bytes and its reference word in a
module-level reference of its own, named
<value>#reference, after every value andlazy valstate word. Why: the program’s roots are a frame of references, so the reference word has to be one of them; the rest is plain data. Alternatives: the cell kept on the heap for module-level values (an allocation per assignment of avar); teaching the root frame a word map (a runtime change for one case). Atomickeeps a reference to a cell: its value is one word thatload,store,swapand the hardware compare-and-set access indivisibly, so anAtomic[int | string]allocates the cell on each store. Why: three words cannot be swapped atomically without a lock. Alternatives: a lock forAtomics of unions (as for integers wider than 64 bits; slower for every operation).- A load from storage reads a tag of 0 (a reference) only beside a non-null reference word, and
any other zero tag as the first scalar member’s. A racing read may combine a tag and a reference
from two writes, as it may an
i128‘s words, and an array element not yet filled is all zero; either way the value read is one of a member, never a null taken for a reference. Why: the promise that a race never breaks memory safety; it costs two compares and two selects per load. Alternatives: no check (a racing read could dereference null); a lock per union field (a cost on every access for a race the program should not have). Review with the user: a racing read of a union may now combine two writes, an exception the threads chapter states beside wide integers. - An integer member wider than 64 bits is kept boxed in the reference word under tag 0, its
type told by its box’s record, so
i128 | inthas a reference word and injecting ani128allocates its box. This fixes the layout above, which kept such a member in the 64 bits and lost its high bits. Why: the bits slot stays 64 bits for every union, and a wide integer, rare in a union, costs a box as it does in anAny. Alternatives: a bits slot as wide as the widest member (a layout per union type, and every helper and the call words taking a width); refusing integers wider than 64 bits as members (a gap in the language). - A tuple with a union part is not answered as words by
val (a, b) = f(x): the call makes the tuple, and the parts are read from it. Why: a result’s words do not nest a union’s words yet. Alternatives: flattening the union’s words into the result’s (a later optimization).
- Every storage place holds the words: a field of a data value, a class or a tuple, an array
element (so a
-
Settled on the user’s delegation 2026-11-15 (built on branch
union-tag-payload): Tuple type patterns by their parts’ layouts. A tuple type pattern matches a tuple whose type as made is seen as the target with no conversion, part by part: a part that is an object (a string, a tuple, a data value, an object of a class, a function, or a union of references) is seen as anAnypart, so a(string, string)and a(Dog, string)are(Any, string)s; a scalar part, or a union with a scalar member, is only that very part, so an(int, string)is no(Any, string)and an(int, bool)no(int | string, bool); a part naming a union of references takes any object there and then tests that object’s own type against the members, so(Dog | Cat, int)matches a tuple made as(Dog, int), as(Dog | Cat, int)or as(Any, int)holding aCat, and not one holding aBirdor a boxed number. A pattern on a tuple of known type that could never match by this rule is the error any such pattern is (a value of type (int, bool) is never a (int | string, bool), so this type pattern never matches). Why: the chapter’s rule that a tuple converts only where each part keeps its layout decides which tuples a pattern can take as its type; a union of references is laid out as anAny, so a tuple made with one records anAnythere and only the object can say which member it is. Alternatives: matching only a tuple made with exactly the pattern’s type (what was built:("a", "b")was no(Any, string)); testing every part by the value it holds (rebuilding the tuple at the pattern’s layout where a scalar part would need a box, an allocation hidden in amatch). Review with the user: a union-of-references part tests the object, while a class part tests the type the tuple was made with. -
Settled on the user’s delegation 2026-11-11 (built on branch
incremental-default): The instance cache is on by default for every command that builds:avin build,run,testandemit-llvm.AVIN_INCREMENTAL=offturns it off,verifystays, andon, unset or empty are the default; any other value is an error for the commands that build, whileavin check(even with--bindings) neither reads the variable nor keeps a cache. The language server only checks, so it has no build to cache. WHY: the whole corpus built warm underverifymatched its clean builds, the commands’ tests hold every command to a clean build after an edit, and the cache needs no care (another compiler’s entries are misses and trimmed after an hour; damage is a miss). Alternatives: on forrunandtestonly,buildstaying clean for release builds (a release build has the same oracle and gains as much); an--incrementalflag rather than a variable (a flag every command would carry for a setting nobody changes per build). Review with the user: the disk it takes, about the size of the program’s text per kind and level (185 MB for marshal at-O2). -
Settled on the user’s delegation 2026-11-11 (built on branch
incremental-default): A program of one file names its cache directories after itself,.avin/build/incremental/<stem>-<kind><level>, while a directory or package keeps<kind><level>. WHY: every file of a directory shares that directory’s.avin/build, as their executables already do (named by stem); with one directory per kind and level, two programs built in turn would overwrite each other’s manifest and an hour later trim each other’s entries. The suffix is one of four fixed words, so no stem makes two programs’ names meet. Alternatives: a subdirectory per file (incremental/<stem>/program-O2, which a file namedtests-O0.avinwould make collide with a directory program’s); one shared directory (correct, since entries are content-addressed, but each program would lose its reuse in turn). -
Settled on the user’s delegation 2026-11-11 (built on branch
incremental-default): A manifest names only module files of its own directory: a name that is not hexadecimal digits and.modis passed over as damaged and never read. WHY: a damaged manifest could otherwise send the reader to../paths outside the cache; nothing a build writes has another form. Alternatives: trusting the manifest (only the checksum would stand between a stray path and its contents being read as entries). -
Settled on the user’s delegation 2026-11-11 (built on branch
incremental-default): Code that calls the C unit’s glue is never taken from the cache’s lowered entries, and the glue it calls is part of its text’s key; a C callback’s body is keyed by its binding and its trampoline’s name. The warm corpus run found three stale texts: the glue (avin_c_call_<n>,avin_c_field_get_<n>,avin_c_retain_<n>and the rest) is named by the checker’s indices, which a declaration added earlier renumbers, and no key held those numbers; and every callback body had one key, so one binding’s callback took another’s text. WHY: the functions that call glue directly are the bindings’ own bodies, fields and handles, which are small and already mostly lowered every build, and covering the names in the text key also covers the copies inlining makes of them. Alternatives: name the glue by what it glues, as the stable names do for everything else (the right end state, but it changes the C unit and every place lowering calls into it); a digest of every C declaration’s number in every key (a declaration added anywhere would re-lower a C program whole). Review with the user: stable C glue names would let these functions be reused too. -
Settled on the user’s delegation 2026-11-11 (built on branch
incremental-default): The warm corpus run is chosen byAVIN_INCREMENTAL=verifyin the environment ofsysl test compiler: each corpus program is built cold with an empty cache, edited by adding a function nothing calls at the end of its first non-literate file, and built again from the cache inverifymode, which also builds it clean; the warm build is the one run. Unset, the gate builds each program once with no cache. WHY: the warm run builds every program three times, so it belongs before a release or after a change to the cache, not in every gate; the edit changes the source and the executable’s key but no line any program prints or traps at, so the corpus’s expectations still hold. Alternatives: the warm run in every gate (triples the corpus’s compile time); an edit inside a function (moves trap lines the.errfiles record, or changes what a program does). -
Settled on the user’s delegation 2026-11-11 (built on branch
site-prime-sieve): A program the website shows is run-checked from the page itself. Indocs/content/**/*.md, a fence whose info string carries the wordrunafter its language (```text run) holds a complete program, and the next fence, carryingoutput(```text output), holds exactly what it prints, with prose allowed between them. The corpus test builds every marked program at-O0and-O2, runs it as an example is run, and fails naming the page and line when it does not compile, ends other than with exit 0, or prints anything but its output fence; arunfence with nooutputfence after it, anoutputfence with norunfence and a marked fence never closed fail the same way. Unmarked fences stay illustrations. WHY: the page is the one copy of the program, so what the reader sees is exactly what was built; the words after the language leave the rendered page as it was (the site renders the fence by its language alone); the run reuses the examples’ check, so a shown program meets the same standard asexamples/. ALTERNATIVES: keep each program as a file underexamples/and check that the page’s fence is byte-identical to it (two copies to edit, and the output on the page would need a third check against the.outfile); an HTML comment before the fence as the marker (invisible in the page but present in its source, and a second line to keep beside the fence); a literate.lavinpage (the site renders indented code differently from fences). -
Settled by the user 2026-11-12 (built on branch
parameterless-methods): a method declared with no parameter list is called with no parentheses.head -> T = …in a class, trait, object or impl is called asxs.head; a method declared with()keeps them at the call,buf.clear(),iter.next().account.depositstays a method value, bound to its receiver, for a method with a parameter list. A parameterless method has no method value: the function that reads one is the lambda() -> xs.head, and there is nom _form. REJECTED: omitting()at the call of any method of no parameters, sincex.mwould then be both a call and a method value, and the parentheses that mark a call with an effect would be gone. -
Settled on the user’s delegation 2026-11-12 (built on branch
parameterless-methods): parentheses after a parameterless method call what it yields.t.adder(4), whereadder -> (int) -> int, calls the functionadderyields, andt.items(2)indexes the sequenceitemsyields;c.head, whereheadyields neither (or a sequence given no index), is an error naming the fix, “headtakes no parameter list, so it is called without parentheses: writehead, nothead()“. The same holds inside the class by bare name and throughsuper. WHY:x.m(a)must mean one thing, and the declaration saysmtakes no arguments, so the only call the parentheses can make is of the result; reportingx.headinstead of reading it as a call keeps the rule visible at every wrong use. ALTERNATIVES: acceptingx.headas a synonym ofx.head(two spellings of one call, and it hides a callable result’s call); refusing parentheses after a parameterless method altogether (thent.adder(4)would need(t.adder)(4)). -
Settled on the user’s delegation 2026-11-12 (built on branch
parameterless-methods): the parameter-list shape is part of a signature. Overriding or implementing a parameterless method with a()one, or the reverse, is an error naming the shape to write; it applies to class overrides, trait implementations in classes and in a data type’s impls. WHY: a call site written against the trait must be valid against every implementation. ALTERNATIVE: letting the override’s shape win (a call through the trait and through the class would be written differently). -
Settled on the user’s delegation 2026-11-12 (built on branch
parameterless-methods): a public field implements an abstract parameterless method. A trait’s or an abstract class’ssize -> intwith no body is implemented by a method, or by a publicvalorvarfield of the name (avalclass parameter included), or for a data type by a field of its one variant; the field’s type must be the method’s result. A private field does not, and is named in the error; a field still cannot share its name with a method that has a body (a default is not replaced by a field). The converse is unchanged: a trait’s abstractvalis supplied only by a field. WHY: a parameterless method reads like a field at every call, so a class whose answer is stored should be able to store it; only an abstract one is implemented this way, so a default body is never silently replaced. ALTERNATIVES: methods only (a stored answer needs a method that returns the field); letting a field replace a default too (a field would override silently, withoutoverride). Reviewed with the user 2026-11-12 and kept:varfields are accepted, so a parameterless method may yield a different value at each read through the field. -
Settled on the user’s delegation 2026-11-12 (built on branch
parameterless-methods), then revised by the user the same day (next entry): only members are declared without a parameter list. A top-level function or a local function declaredname -> T = …is an error namingname() -> …andval name = …. WHY: the smallest choice; a module value computed once is already aval, and the call-without-parentheses reading is what a member of a value needs. ALTERNATIVES: top-level parameterless functions called by bare name, recomputed at each read (a second kind of module-level name that reads like avaland is not one). Review with the user if module-level computed names are wanted. It was reviewed: the user chose the alternative, written withdef. -
Settled by the user 2026-11-12 (built on branch
def): optionaldef;defpermits a parameterless top-level/local function.defmay begin any function or method declaration, members of a class, trait, object or impl, statics, top-level and local functions, with or without a parameter list and on functions defined by clauses, and means nothing more there:def f(x: int) -> int = …isf(x: int) -> int = …. At the top level and in a block,def now -> int = …declares a function with no parameter list, by the rules of a parameterless method: read by its bare name and run again at every read, parentheses after it calling what it yields (a function or a sequence given an index, and otherwise an error namingnow), no function value (the lambda() -> now, named by the error where a function is wanted), no type parameters of its own, never assigned, the only function of its name in its scope and sharing that scope’s namespace with values. Written withoutdefthere,now -> int = …is an error namingdef now -> …first, thenval now = …andnow() -> ….defis a keyword. Style:defis written only where it is required; the library and tests use it nowhere else, apart from the tests of the optional form. Also built on branchdef: a method of a data type’s or a built-in type’s impl defined by clauses matches its arguments and not its receiver, as a class’s method’s clauses already did (they were refused for counting the receiver as an argument). -
Settled on the user’s delegation 2026-11-12 (built on branch
parameterless-methods): a parameterless method is the only method of its name in its type, inherited ones and the methods impls add included; and it takes no type parameters of its own, a parse error, sincex.first[int]would read as indexing its result (its class’s type parameters it has). WHY:x.headcalls the parameterless one, which leaves no call to choose another overload with. ALTERNATIVES: overloading resolved by whether parentheses follow (two methods behind one name with different call shapes); type parameters writtenx.first[int](indexing and type application become ambiguous after a member). -
Settled on the user’s delegation 2026-11-12 (built on branch
parameterless-methods): naming a parameterless method where a function type is expected is an error naming the lambda, “headtakes no parameter list, so it has no function value: naming it calls it; for a function, write a lambda, as in() -> x.head“, unless the method yields a function, which is then the value.super.namewith no call reads a superclass’s parameterless method and is refused for one with a parameter list. WHY: the plain type mismatch (“expected () -> int, found int”) hides that the user meant a method value. ALTERNATIVE: the generic type-mismatch error. -
Settled on the user’s delegation 2026-11-12 (built on branch
parameterless-collections): the collections’ pure accessors are parameterless methods, onIterable,Iterator,Seq,Set,Map, every immutable and mutable collection,Builderand their impls:head,last,headOption,lastOption,tail,init,size,length,knownSize,isEmpty,nonEmpty,min,max,minOption,maxOption,sum,product,reverse,distinct,indices,flatten,transpose,unzip,zipWithIndex,keys,values,keySet,toList,toVector,toArraySeq,toSet,toMap,toSortedSetandtoSortedMap. Kept with():iterator(),toArray()andtoBuffer()(each a fresh mutable object),next(),hasNext(),buffered(),view(),peek()and every mutating method; the internalerasedSize()/erasedLength(). No accessor had an overload with parameters to give up:min/maxwith an ordering areminBy/maxBy, and the freemin(a, b)andmax(a, b)are functions, not methods. WHY: these answer from the collection without changing it, which is what a parameterless method says; one spelling across every collection, since the shape is part of the signature and generic code overIterable[T]reads them the same way. Reviewed with the user 2026-11-12 and kept: an iterator is anIterable, soit.head,it.size,it.toVectorare parameterless too and read from it, against the rule that a method with an effect keeps its(). ALTERNATIVES weighed: keep these()onIterableand convert only where the receiver is a collection (impossible whileIteratorconforms toIterable, the shape being part of the signature); split aCollectiontrait offIterablefor the accessors so an iterator keeps()(a library reshaping larger than this sweep); convert onlyhead/size/isEmpty(a mixed spelling a reader has to memorise). Option, Either, Result,stringand the numerics keep()for now (wave 2), since no trait they implement forced them. -
Fixed 2026-11-12 (branch
parameterless-collections): naming a parameterless method of a generic class or trait where a function is expected,val f: () -> int = xs.headon aVector[int], now gives the lambda error: what the call yields is read at the receiver’s type arguments, where before the method’s ownThid it and the plain type mismatch was reported. The compiler’s own expansions (aforover an array or a range, a sequence pattern) readlengthandnonEmptywithout a call. -
Settled on the user’s delegation 2026-11-12 (built on branch
def):defcomes after the modifiers and the annotations, once:@tailrecon the line before, thenprivate override static def f(…);def private fis an error namingprivate def f,def def fan error, anddefbeforeval,varorlazy valan error saying a value is declared without it. WHY: the modifiers describe the declaration anddefbegins it, sodefsits next to the name it introduces, asvaldoes inprivate val x; one place keeps declarations uniform to read and to search. ALTERNATIVES:deffirst and modifiers after it (def private f), or either order (two spellings of one declaration). -
Settled on the user’s delegation 2026-11-12 (built on branch
def):def name = bodywith no parameter list and no result type is a parameterless function or method whose result is inferred, at the top level, in a block and as a member (def perimeter = 2.0 * (w + h)). Withoutdefa name followed by=is an assignment, so onlydefcan say this. WHY: a parameter list’s absence is whatdefpermits, and every other function may leave its result to inference; refusing it would makedefrequire a written type for no reason of its own. ALTERNATIVE: requiring-> Tafter a parameterlessdef(one shape, more to write). An indented body afterdef namewith neither=nor->is refused, namingdef name -> T = …,def name = …andname(), since a body run for its effect is declared with(). Review with the user: whether the inferred form is wanted at all. -
Settled on the user’s delegation 2026-11-12 (built on branch
def):defon a clause and on a field is refused:defbelongs to a function’s signature, never to the clauses after it (a clause written withdefis reported and then read as the clause it is), anddef val xis an error rather than a field (then read as thevalit is). WHY: one keyword per declaration, and a field already has its own. ALTERNATIVE:defaccepted and ignored before a clause (two spellings of one clause). -
Settled on the user’s delegation 2026-11-12 (built on branch
def):override defanddefon trait members change nothing about overriding: a parameterlessdef name -> Toverrides or implements only a parameterless method, exactly as withoutdef, andoverrideis still required where it was. WHY:defadds no meaning to a member. ALTERNATIVE:defimplyingoverride(two spellings would mean different things). -
Settled on the user’s delegation 2026-11-12 (built on branch
def): the diagnostics for a parameterless function name it by its own name, also when it is reached through a module:val f: () -> int = clock.nowreports “nowtakes no parameter list …, as in() -> now“. WHY: the checker sees the resolved function; the module-qualified spelling would need the source text. ALTERNATIVE: name the qualified spelling,() -> clock.now(more exact; a small later change). -
Settled on the user’s delegation 2026-11-12 (built on branch
grammar-tests): Settled on the user’s delegation 2026-11-12 (built on branchgrammar-tests): the editor grammar tests run in the release flow, not in the compiler gate.sysl test editors/grammar-testsis a package of its own so the compiler gate does not need Oniguruma; it broke unnoticed on a Sysl upgrade because nothing ran it.scripts/release.shruns it (step03b-grammar, through the slot wrapper) before tagging, and the director runs it after any Sysl bump or grammar change. WHY: the grammar ships in the VS Code extension and the IntelliJ plugin, so a release must not carry a grammar whose tests cannot build; the run takes seconds. ALTERNATIVES: adding it to the compiler gate (couples the gate to a native Oniguruma build and to the highlighter package’s Sysl pin); a CI-only job (no CI runs here). Review with the user if the gate coupling is preferred. -
Settled on the user’s delegation 2026-11-12 (built on branch
runner-orphans): Every program a runner starts leads a process group of its own, and nothing in that group outlives it.avin test(each test and hook), the execution corpus and the documentation-programs check start each program with a new process group, so whatever it starts in turn is in the group too. Once the program has been waited for, whatever is left of its group is sentSIGTERM, given 200 ms to go (the same grace the system layer gives a program that outstays its limit), then sentSIGKILL: after every run, not only after a timeout, since a test that passed but left a server’s worker running orphans it just the same. A runner stopped bySIGINT,SIGTERMor now alsoSIGHUP(exiting 130, 143, 129) sendsSIGKILLat once to every group still running, with no grace, because whoever stopped it is itself about to make it stop. WHY: the orphans found 2026-11-12 (a corpus program spinning for 8 h; two left idle for 30 h) were programs and grandchildren that the runner never reached once the timeout had killed only the leader, or once the runner itself was stopped. ALTERNATIVES weighed: enforcing the limit on the whole group at once (SIGTERMto the group at the deadline rather than to the leader first) needs a watchdog thread of the runner’s own in place of the system layer’s timeout, for a difference only in the order the grandchildren hearSIGTERM; a child-side check that its parent has gone (macOS has no parent-death signal, so every Avin program would poll); a longer grace (a test’s tidy-up has its whole limit already). Known limit: a runner killed withSIGKILLcannot act, and its programs, no longer in its group, are not reached by a signal sent to that group; marshal andsysl testboth sendSIGTERMfirst. A program that moves itself into another group or session is also beyond reach.avin runis unchanged: its program stays in the terminal’s group so that Ctrl-C and job control reach it. -
Settled on the user’s delegation 2026-11-12 (built on branch
field-shadow): A field may share its name with a trait’s method that takes a parameter list.x.nameand a barenameread the field;x.name(args)and a barename(args)call the method (a bare call isself.name(args), which already put methods first); through the trait or a type parameter it bounds only the method is seen. A method of no trait, or of no parameter list, still may not share a field’s name, and is reported at its own declaration; what a derived impl lacks is reported at thederivesentry, never in the library’s template. WHY:display,debug,compareand the rest are ordinary field names (data Config(host: string, debug: bool)), and every data type derivesDisplayandDebugwithout asking, so refusing the pair made such a type unprintable with an error insideformat.avin; the read/call split is the rule member access and calls already followed, so no program changes meaning. A field holding a function under such a name is called by reading it first (val f = x.name). ALTERNATIVES: renaming the protocol methods to reserved spellings (breaks every hand-written impl and still leaves a name a field can take); having the library and templates call through a qualified trait form such asDisplay.display(x, …)(no such form exists, and it would fix only the library’s calls, not a program’s own impl); refusing the field with a better message (keepsdebug: boolillegal). Review with the user: it widens what a type may declare. -
Settled on the user’s delegation 2026-11-12 (built on branch
main-result):mainmay answer withResult[unit, E]orResult[N, E]for any integer typeN, and also withResult[Nothing, E]. AnErris written to standard error aserror:followed by itsDisplay, and the program exits with 1. The line is written before the exit hooks run.Ok(n)exits withn, as a plain integermaindoes. WHY: this lets a whole script use?. Theerror:prefix matches the compiler’s own diagnostics and is what a command-line user expects. Status 1 is the ordinary failure status, and it is distinct from a trap, which ends the program with a signal. Allowing any integer type matches the plainmain, which may yield any integer.Nothingcoversmain() = Err(…), whoseOktype is inferred asNothing. ALTERNATIVES: allow onlyintinOk(narrower than plainmainfor no reason); give each error type its own status (there is no agreed way to choose one, and a program that wants a particular status callsexit); trap onErr(a trap reports a source position and signals, which is wrong for an expected failure such as a missing file). -
Settled on the user’s delegation 2026-11-12 (built on branch
main-result): The error type of aResult-answeringmainmust implementDisplay. There is no fallback toDebug. A union of errors needsDisplayon every member. WHY: the line is meant for the program’s user, and aDebugform, such as quoted strings or field names, reads as an accident. This is the same rule that applies to the error of a@testfunction answeringResult[unit, E], so the twoResultreaders agree. Data types getDisplayautomatically wherever their fields have it, so the requirement rarely costs anything. ALTERNATIVES: fall back toDebugwhen there is noDisplay(more programs compile, but some errors would be shown in a form nobody chose); show any value at all through the runtime renderer (same objection, and weaker). The user may want to revisit this if programs commonly hit errors that have onlyDebug. -
Settled on the user’s delegation 2026-11-12 (built on branch
parameterless-wave2): the rest of the standard library’s pure accessors are parameterless. The rule applied: a public method of no parameters is declared without a parameter list when it answers from its receiver (or, static, from its type), changes nothing, and hands out nothing to change or use up; the same rule wave 1 applied to collections, wherereverse,distinctand the immutable conversions count as accessors. Converted: Option’sisDefined,isEmpty,nonEmpty,get,toList,toVector,toArraySeq,knownSize,flatten,unzip; Either’sisLeft,isRight,swap,toOption,toList,toVector,merge,joinLeft,joinRight; Result’sisOk,isErr,ok,err,toList,flatten; a pair’sswap; string’sbyteLength,charCount,isEmpty,nonEmpty,isBlank,head,last,headOption,lastOption,tail,init,reverse,chars,bytes,lines,trim,strip,stripLeading,stripTrailing,stripLineEnd,capitalize,toUpper,toLower; char’sisDigit,isLetter,isLetterOrDigit,isSpaceChar,isWhitespace,isUpper,isLower,isControl,toUpper,toLower,asDigit; the integers’abs,sign,bitCount,leadingZeros,trailingZeros,isPowerOfTwo; real’sisNaN,isInfinite,isFinite; Enumerable’svalues(static),ordinal,name; StringWriter’stext,length,isEmpty; ByteView’slength;sorted,firstKey,lastKey,toTreeMap,toBitMaskand a queue’sfront,frontOption,dequeue,dequeueOption,toQueue, which wave 1 missed; regex’spattern,regex,anchored,unanchored,groupCount,groupNames,matched,start,end,before,after,subgroups; time’s int and longmicros…weeks, Duration’stoDays…toSecondsReal,isNegative,isZero,abs, Instant’s and Zoned’sepochSeconds/epochMillis/epochMicros, every Date, Time, DateTime and Zoned field reader (year,month,day,weekday,hour,startOfMonth,date,time,abbreviation, …), Period’smonths/yearsand readers, Weekday’sisoNumber, Zone’snameandisFixed; every error type’smessage; Url’sportOrDefaultandqueryParams, an HTTP response’s and request’stext, a request’squeryParams; ExitStatus’sisSuccess, Command’sclearEnvandinNewGroup; Weighted’ssize; Json’sisNull,asBool…asMembers,keys,size,render,renderAscii. A trait’s static member declared without a parameter list is now read through a type parameter too,T.values(it was refused as “Tis not defined”), and the infix-postfix diagnostic names both spellings,xs.sizeandxs.size(). Kept with(), the borderline calls: (1) string’stoInt(),toLong(),toIntOption(),toLongOption()have overloads taking a radix, and a parameterless method is the only one of its name, so they keep(), andtoReal(),toRealOption(),toBool(),toBoolOption()keep them with them, one spelling for the family of parsers;stripMargin()likewise besidestripMargin(c). (2) The core traits’ members every type implements or derives —toString(),hash(),zero(),one(),negate(),shape(), Codec’swhenMissing()andjsonKey()— and so Duration’s and Period’szero()/negate(), since changing these changes every program’s own impls and derives; review with the user, as a wave of its own. (3) Reads of shared or outside state: aMutex‘s and a UI state’sget(), a signal’sread(), a future’sisCompleted()/value()/peek(), an executor’sisShutdown(), an actor mailbox’sisEmpty(), and every method of a file, socket, listener, child process or command’s handle (pid(),isAlive(),isClosed(),port()), whose answer can change under the reader. (4) Constructors and factories,Vector.empty[T](),BitSet.empty(),newBuilder(),copy(),Random(). (5) A UI view’s modifierspadded()andpanel(), besidepadding(n)andpad(…), one spelling for the modifier chain. (6) Private helpers and binding classes. Borderline converted:opt.getands.headtrap on None and on an empty string, asxs.headdoes;q.dequeuereads like an action but answers a new queue and changes nothing; a regex matcher’smatched,startandendread the current match of a cursor thatfindNext()moves, as a buffer’ssizereads a buffer thatpushchanges. WHY: one rule across the library, so a reader knows a call’s spelling from what it does; the families above stay uniform. ALTERNATIVES weighed: converting only the brief’s types (Option, Either, Result, string) and leaving char, integer, time and regex for later (two spellings for one kind of method, read side by side in the same expression,s.trim.toInt()besidec.isDigit()); renaming the radix overloads (toIntRadix(16)) sotoIntcould lose its()(a rename of a settled API for spelling alone); convertingtoString()andhash()now (every class’s impls change with them). A trap to know:opt.get()whereopt: Option[() -> T]now calls the function the option holds; the library’s one such site was rewritten toopt.get. -
Settled on the user’s delegation 2026-11-12 (built on branch
bare-method-ref): a method declared with an empty parameter list,m(), named without a call is a function value only where a function type is expected. Anywhere else (println(xs.sorted),s"${s.isEmpty}",c.bump == 0,val v = c.bumpwith no type, an argument for a type parameter orAny), it is an error naming the callx.m()and the lambda() -> x.m(); among overloads with one of no parameters, a bare name with no expected function type gets the same error rather than “ambiguous”. Instance, static and trait methods alike; methods with parameters (account.deposit) are values wherever named, as settled. WHY: with parameterless and()methods side by side, a missing()is the commonest slip, andprinttakesAny, so it compiled and printed<function>; where a function type is expected the value is wanted and type-checks. ALTERNATIVES: refusing method values of()methods altogether (thenspawn(worker.run)needs a lambda); a warning instead of an error (wrong output still ships); extending the rule to top-level functions of no parameters (they are always called with(), so the slip does not arise). Review with the user:val f = c.bumpno longer infers a function. -
Settled on the user’s delegation 2026-11-12 (built on branch
bare-method-ref): a function value stays withoutDisplay, so interpolating one is an error, now with the hint “a function value is never shown: to show what it returns, call it”;print/printlnkeep takingAnyand show a function as<function>. WHY: the empty-list rule above already stops the missing-()slip at its source, and the remaining ways to print a function (a variable or lambda, a method value of a method with parameters) are deliberate; a special refusal insideprintwould make it unlike every otherAnyparameter, against its settled “one ordinary library function”. ALTERNATIVES: refusing a function-typed argument toprint/println(a special case); refusing any conversion of a function toAny(breaks heterogeneousAnycontainers holding callbacks). -
Settled on the user’s delegation 2026-11-12 (built on branch
lazylist-perf): A lazy list’s cell is one object of three words, filled in place by the one function that evaluates it.LazyList[+T]holdspending(the evaluating function until it has run, a constant trapping function while it runs, thenNone),firstandrest; an empty cell is one whoserestis itself, and a cell evaluated as another list’s first cell whose rest would be itself points at that other cell instead (the same element, then itself again), so a list that is its own tail still repeats. Making a cell allocates the cell and the function that evaluates it, and evaluating it allocates only the cells after it and the elements; a cell is read with a test ofpendingand no lock, since a lazy list is not sendable. To keep the element and the rest in a covariant class, the core library gains the intrinsicfield_unset:private var x: T = fieldUnset()is a field the constructor leaves as the zero bytes the object was made with (not yet a value, as an array’s spare capacity is not), which the class’s own code writes before reading it; such a field must be aprivate varwith its type written, is not a position for the class’s variance (it is written only with values computed for that instance), and the intrinsic is the core library’s alone; called anywhere but as a field’s initializer it traps (a field is read before it is set). Measured at-O2(LazyList.from(0)and the stages named, thentake(n), the cost per element; time under a loaded machine, user time): bytes kept per evaluated cell 256 → 48 (resident growth per held cell 304 → 96); bytes allocated per element offrom,map,filterortake304 in 7 objects → 96 in 2, and of#::544 in 13 → 192 in 4 (two cells, each with its function); time per element offrom.take0.118 → 0.035 µs,map0.18 → 0.058,filter0.24 → 0.079,#::0.18 → 0.065, the 4000th prime by the sieve 4.8 → 1.7 s; at-O0from.take0.16 → 0.06 µs.lazy_list_deepruns a million cells again. WHY: each cell was aLazyListobject, a progress object, the closure of itslazy val, a box and a closure to drop the pending function, the function itself, and a tuple for the evaluated element and rest, with a lock-takinglazy valread on every access; the element and rest belong in the cell, which only a field left unset can hold, since a covariant class may not otherwise keep avarof its parameter and a field must otherwise be given a value when the object is made. The counts are pinned bylazy_list_cell_tests.sysl, which reads them from the code each maker compiles to; no runtime allocation counter was added, since the code is where an allocation is decided and the test holds however a run is timed. ALTERNATIVES: a cheaperlazy val(no closure per object) with the tuple kept (three objects per element, still a lock per read);Option[T]for the element (allocates aSomefor every scalar element); a separate evaluated node per cell (two objects); an annotation exempting a field from variance, with an initial value supplied some other way (two mechanisms where one does); a runtime allocation counter exposed to programs (a hook in every allocation, for a check the code already answers). Review with the user:field_unsetis a new escape from the variance and initialization rules, though only the core library may use it. -
Settled on the user’s delegation 2026-11-12 (built on branch
train-c-fix): Proposed (branchtrain-c-fix): an argument that cannot be checked before an overload is chosen is tried against each candidate. Where a lambda’s body, checked with its result left open (the rulemap-flatmapadded forflatMap‘sIterable/Optionoverloads), reports an error, or a generic function named as a value cannot be checked without the parameter’s type, the argument is checked against each remaining candidate with nothing reported and nothing it settles kept; when exactly one candidate takes it, that one is chosen and the argument checked against it. Otherwise the argument is checked as before and reports what is wrong. A lambda whose body never returns (x -> fail(…)) fits every candidate, and the first declared is chosen (an option’s ownflatMapon an option). WHY: with oneflatMap,v.flatMap(n -> if … then aList else aVector)andxs.flatMap(identity)checked against itsIterable[U]; the second overload took that expected type away, so the branches no longer joined andidentitycould not be instantiated — a call that compiled stopped compiling because an overload was added. ALTERNATIVES: always prefer theIterableoverload (a rule naming library types, and wrong for[Some(1)].flatMap(identity)); report such calls as ambiguous and ask for a type (breaks code that worked); join the branches to their least common supertype without an expected type (changesiftyping everywhere). A trial checks the argument once per candidate, which costs only where candidates disagree. -
Settled on the user’s delegation 2026-11-12 (built on branch
train-c-fix): Proposed (branchtrain-c-fix): a class with a field left unset byfield_unsetis made only by its own code and its companion’s.LazyList[int]()from a program made a cell whose function, element and rest were zero bytes, and reading it crashed the program. The constructor of such a class is refused anywhere else:`LazyList` keeps fields its own code fills in, so only the class and its companion make one. WHY: Avin has no private constructors, and the unset fields are safe only because the class’s own code writes them before reading. ALTERNATIVES: module-private constructors in general (a language feature, reviewed separately forTime/Zoned); a constructor parameter of a private type (an extra field in every cell). Review with the user: it is a special case of private constructors, which may want to be the general feature. -
Settled on the user’s delegation 2026-11-12 (built on branch
io-errors): anIoErrorcarries its kind, operation and subject:data IoError(kind: ErrorKind, operation: string = "", subject: string = ""), the former variants becomingErrorKind‘s, each with adescription. It shows ascannot <operation> <subject>: <description>(cannot read nope.txt: no such file or directory), leaving out what is empty, and every erroravin.fs,avin.process,avin.signalandavin.netmake names both: a path (old to newfor a rename), a program,process N,host:port, a socket’s path,a client of <address>for an accepted connection. A program tells kinds apart withErr(IoError(NotFound, _, _)), a guard one.kind, or==. Why: the error a program prints must say what failed and on what, and one type keepsReader,?and every signature as they were. Alternatives: a wrapper per module (FileError(path, kind)), which would split the one error every reader shares and change every signature; a subject field on each variant, which repeats it eleven times; keeping the variants and adding the path only to the message, which leaves the value unable to say what it was about. Review with the user: matching moved fromErr(NotFound)toErr(IoError(NotFound, _, _)), longer at every site that tells kinds apart. -
Settled on the user’s delegation 2026-11-12 (built on branch
io-errors):CommandError.Failed(status, command)names the command’s programs (ls,ls | wc,make && ./app,a || b,a; b), and its message isfalse exited with status 1; an emptycommandleaves it out. Why: a failed status must say which command failed. Alternative: the command only in the message, not matchable. -
Settled on the user’s delegation 2026-11-12 (built on branch
io-errors): the core traitError: Display, with parameterlessmessage -> stringandcause -> Option[Error] = None, and a defaultdisplaythat shows the message, then:and the cause as it shows, leaving out an empty message. Why parameterless: both read what the error holds, the parameterless rule’s case, and a data field namedmessagethen implements the first (the json package’sJsonErrordoes). Why the cause’s display rather than its message: an error with aDisplayof its own (JsonError‘s place) keeps it inside a chain. Every standard-library error type implements it (IoError,CommandError,HttpError,UrlError,TlsError,TimeParseError,ZoneError,PatternError,MatchError,AskError,Utf8Error,JsonError), eachmessage()becomingmessage, andTlsRefusal.messagewith them. A wrapper that only re-tags another error (CommandError.Io,HttpError.Io,TlsError.Transport) has that error’s message and no cause, so it shows once. Alternatives:message()with parentheses, as before (against the parameterless rule); asourcechain printed separately rather than in the display (a program would have to walk it to print anything useful). -
Settled on the user’s delegation 2026-11-12 (built on branch
io-errors): a data type implementing a core trait that givesdisplay(ordebug) a body takes that method rather than the automatic one made from its fields, as it does where its own impl declares the method. Why:impl Error for ParseErrormust show the sentence, notParseError(3). Only core-library traits are looked at, since the automatic derivation is decided before names resolve. Alternative: making each error type also writeimpl Display, which every program’s error type would have to repeat. -
Settled on the user’s delegation 2026-11-12 (built on branch
io-errors):Result[T, E].context(text: -> string) -> Result[T, ContextError], forE: Error, anddata ContextError(message: string, inner: Error)in the prelude, whose cause isinner. It works on a union ofErrortypes and a type parameter bounded byError, and?passes it, and every other error type, unchanged intoResult[T, Error]. Why by name: the text is usually interpolated and is needed only for anErr. Alternatives:withContext(f: () -> string)beside an eagercontext(two names for one thing, which by-name already covers); a context method onOptiontoo (not added:okOrmakes the error first); keeping the wrapped error’s static type (ContextError[E]), which a chain of contexts would nest in its type. -
Settled by the user 2026-11-13: JSON is the package
dev.avinlang.json, in its own repository (github.com/avin-lang/json, version 0.0.1), not a module of the standard library; it supersedes the 2026-11-12 entry below. The library’slibrary/avin/jsonand its testslibrary/tests/jsontestsmoved to the package, whichavin testruns; the tests of the README’s examples went with them.import avin.json(whole, a declaration, a group, or under another name) is an error naming the package: JSON is the packagedev.avinlang.json; add it to your dependencies; so isimport jsonin a program with no module or declarationjsonand no dependency on the package. The corpus programs that test the compiler or runtime with JSON (derivation’s diagnostics, the collector’s stress, traps, threads and sockets) became manifest programs intests/programs/{run,reject}/json_*depending on the package by the path../../../../../json, the sibling checkout~/dev/avin-lang/json, as the compiler reaches~/dev/sysl-lang/parsing. JSON derivation needed no compiler change: its templates are ordinaryderivetemplates found in the module a file imports from. A single-file script that needs JSON declares the dependency in the script itself (a separate item,script-deps). -
(Superseded by the user’s decision of 2026-11-13, JSON is the package
dev.avinlang.json.) Settled on the user’s delegation 2026-11-12 (built on branchjson-stdlib): JSON isavin.jsonin the standard library, moved from the packagepackages/json(modulejson); it supersedes the 2026-11-06 entry that made it a package, and the one that had the corpus gatepackages/json‘s tests. Its tests arelibrary/tests/json_*.avin, run with the core library’s own; its corpus programs are single files intests/run/json_*.avinandtests/reject/json_*.avinwith no manifest. An import that leaves outavin.,import jsonorimport fs.readText, is an error naming the import meant (it reads: there is no modulejson; the standard library’s isavin.json, imported asimport avin.json), unless the program has a module or a top-level declaration of that name. Why: reading JSON is the first thing many scripts do, and a script of one file has no manifest to name a dependency in; marshal and most services need it; and the library is read only where imported, so a program that does not import it pays nothing. The hint is general rather than a list of package names because the one well-known package name a script reached for is now a library module, and a list in the compiler would go stale. Alternatives: a package the compiler makes available by default without a manifest (a second, implicit dependency mechanism with its own versioning); keeping the package and only improving the diagnostic (still no JSON for a lone script); the module namedev.avinlang.jsonfor the package (the prefix packages take, but still a package). Programs outside this repository changeimport jsontoimport avin.jsonand drop thejsondependency from their manifests. Review with the user: it reverses a settled decision, and it widens what the standard library holds from “what talks to the operating system” to “the formats nearly every script reads”. -
Settled on the user’s delegation 2026-11-12 (built on branch
defer-use): resource cleanup is a block-scopeddeferstatement, and the library’s resources are each anio.Close(defer,Close).defer stmt(ordeferand an indented block) runs the statement when control leaves the block it is written in: at the block’s end,return,?‘s failure arm,breakandcontinue. The reached ones run last first; one not reached never runs; names are read when it runs, and a block’s,return‘s orbreak‘s value is computed before. Noreturn,?, orbreak/continueof an outer loop may leave a deferred statement. It is a statement of a block only: as a value, a one-line branch or in a class body it is refused. While one waits, nothing is in tail position, so@tailrecrefuses a self-call there.deferbecomes a keyword (one test function nameddeferwas renamed).- A trap and
process.exitrun no deferred statement. There is no unwinding; files and connections left open are closed by the collector’s finalizers. - Settled on the user’s delegation 2026-11-15 (built on branch
defer-on-cancel): a cancelled thread runs its deferred statements, innermost first, as at any other way out of their blocks, wherever its cancellation stops it (a wait, a safepoint poll), and then its frames are dropped as before. A thread running a scope stops first at that scope: the scope body’s deferred statements run, the scope cancels its threads and waits for them (each running its own), then the functions around the scope run theirs. A deferred statement runs to its end once begun: the thread’s cancellation does not stop it inside one (its own waits are not cancellation points while it runs, as while a lock is held), and one that comes meanwhile stops the thread at its next cancellation point after; one that traps stops the program, as any trap. A cancelled wait on a mutex’s condition stops the thread holding the lock again, so awithbody’s deferred statements run under it andwith‘s owndeferlets it go; the library’s internal conditions still stop without the lock, as their code expects.Pool‘s putting back what a cancelled call held is now adefer. Why: cancellation stops a thread at a known point, a wait or a poll, in a consistent state, unlike a trap. Without it no library or package can clean up after a cancelled task: found writing a PostgreSQL client, where a cancelled query must send a CancelRequest, a cancelledtransaction(f)must roll back, and a pool lease or aMutex.withmust be given back. Alternatives weighed: a publiconCancel(cleanup)(body)inavin.threads(a second mechanism besidedefer, and lambdas again, with thereturn/?/breakproblemdeferwas chosen to avoid); leaving it (no cleanup at all after a cancellation); running a deferred statement with cancellation live (a cleanup that waits could itself be cut off half done). - Each deferred statement is its closure, put on the thread’s list where the
deferis reached (lower.sysl‘sDefer,runtime/avin/rt/defers.sysl): every way out of the block runs the block’s own from the list, newest first, and a cancellation runs every one reached since the cancellation point it returns to before it drops their frames; a trap in an actor’s turn drops the ones it passes unrun. A function that defers nothing never touches the list. The checker checks the statement as a lambda of no parameters that no jump may leave, so avarit reads is shared as a captured one is. Why: the cancellation unwinds by returning to the cancellation point past every frame between, so what those frames deferred must be reachable from the thread itself; a list costs a closure and two runtime calls per deferred statement and nothing anywhere else. Alternatives weighed: emitting each deferred statement inline at every exit, as before, and a landing pad per function that defers (asetjmpin every such call, with the locals it reads unreliable after the return); a frame-local record pointing at a compiled cleanup function (no allocation, but a new kind of stack object for the collector and the code generator). Review with the user: deferred statements now allocate a closure where they capture anything, a cost on the ordinary path (Mutex.withamong them); a later pass could emit them inline again where no cancellation point can be reached between thedeferand its block’s end. trait io.Close { close() -> Result[unit, IoError] }, closing twice answeringOk:fs.File(unchanged), the newfs.TempDirfromfs.tempDir(prefix)(closeremoves the tree), everynet.ByteStream,TcpListenerandUnixListener(theirclosenow answersOk(())rather thanunit;TlsStream‘s answers the failure to send its close notice), andprocess.Child(newclose: kill if not seen to end, then wait; a detached child is let be).Mutex.with/updaterelease their lock throughdefer.- Why: the paths that leak are early
return,?andbreak, and only a construct the compiler places at every exit covers them; a libraryuse(r)(body)puts the body in a lambda, where areturn, a?of the enclosing function, abreakor acontinuecannot be written at all. Block scope (not function scope) gives back each loop turn’s resource before the next and needs no run-time state; reading names at the exit needs no storage. The syntax and the rules are Sysl’s owndefer, so the two languages read alike.Closeanswers aResultbecause a flush, a removal and a wait can fail, andFile.closealready did. - Alternatives weighed: a library
use(resource)(body)over aClosetrait (cannot leave the enclosing function from the body; nests one lambda per resource); function-scopeddeferevaluating its arguments where written (holds every turn’s resource until the function returns, needs a run-time list);try/finally(a second block structure for one need); running deferred statements on a trap (unwinding through a broken state); aClosewhosecloseanswersunit(would dropFile.close‘s flush error and aTempDir‘s removal error);use x = ebinding sugar overdefer x.close()(left for later;defercovers it in one more line). - Review with the user: whether discarding a
close‘sResultindeferdeserves a warning; whetheruse x = esugar is wanted.
-
Settled on the user’s delegation 2026-11-12 (built on branch
numeric):Numeric, the numbers’ bound. A core traitNumeric: Add, Sub, Mul, Div, Rem, Neg, Ord, Display, DebugdeclaringtoReal -> real;Integernow requires it (trait Integer: Numeric), so every width meets it through oneimpl[T: Integer] Numeric for T, andrealhas its own impl. Why: a mean, a clamp or a running total overintandrealalike had no bound to name ([T: Add]cannot reach areal, andIntegerexcludesreal); taking every operator the integers andrealshare (DivandRemincluded, though their meaning differs: integer division truncates and traps on zero) gives the most generic code, andzero/oneare alreadyAdd‘s andMul‘s. Alternatives: onlyAdd & Sub & Mul & Ord(the audit’s sketch), which leaves/out of generic numeric code; aNumericthat also offeredfromInt/T(n)construction, left out sincezero/onecover the identities and a conversion from integers is lossy at narrow widths; a separateFractionalforreal, not needed whilerealis the one non-integer. Review with the user: whetherDivandRembelong in it. -
Settled on the user’s delegation 2026-11-12 (built on branch
numeric):Numericis open. UnlikeInteger, a program’s own type that implements the required traits andtoRealis a number (a rational type is the example in the tests). Why: a library number type (a decimal, a rational, a fixed-point) should reach every[T: Numeric]function. Alternative: closed likeInteger, which would keeptoRealmeaningful only for built-ins at the cost of every user number. -
Settled on the user’s delegation 2026-11-12 (built on branch
numeric):averagetotals asrealand traps when empty.averageon a collection ofNumericelements is arealmean summed throughtoReal, so integers whose sum overflows their type still average (beyond 2⁵³ the total rounds);averagetraps on an empty collection asmaxandmindo, andaverageOptionanswersNone. Alternatives: summing inTand converting once (exact for small integers, but traps where the mean is representable); NaN for an empty collection (silent, unlikemax); onlyaverageOption.sum,product,minandmaxwere already generic overAdd,MulandOrdand are left as they were rather than duplicated onNumeric. -
Settled on the user’s delegation 2026-11-12 (built on branch
numeric):real(x)on aNumericparameter is refused, naming.toReal. A call converts only a type parameter bounded byInteger; aT: Numericconverts with its own method. Why: a conversion call on a type parameter is lowered per instance by the compiler for integers only, whiletoRealis an ordinary trait method a program’s own number implements. Alternative: lowerreal(x)tox.toRealfor aNumericparameter, more uniform with the integers’real(x), at the cost of a second meaning for a conversion call. -
Settled on the user’s delegation 2026-11-12 (built on branch
http-verbs): the HTTP client has a function per common verb, each taking its headers.http.get,headanddelete(url, headers = []);http.post,putandpatch(url, body: string, contentType, headers = []), the content type sent first and the body as UTF-8. Headers are aVector[(string, string)], asRequestandResponsealready hold them. Why: one call for the everyday request, with the shapepostalready had; anything rarer (another method, a byte body, a timeout, TLS settings) stayssend(Request(...)). Alternatives weighed: an options record per call (a second way to spellRequest); aMapfor headers (loses order and repeated names, which HTTP allows); byte-body overloads ofpost/put/patch(left toRequest.withBody, to keep one overload per verb). -
Settled on the user’s delegation 2026-11-12 (built on branch
http-verbs): aRequest‘s headers are checked as it is made, those given to its constructor too. The constructor traps on a header name that is not a token or a value holding a line break, aswithHeaderdid; before, a header passed to the constructor was written unchecked, so a value holding\r\ncould add a header of its own. Why: a verb’sheadersreach the constructor, so this is where every path meets. Alternative weighed: checking as the head is written (as the server does for aResponse), which would trap later, away from the code that built the request.withHeaders(more)adds several in order. -
Settled on the user’s delegation 2026-11-12 (built on branch
http-verbs): query parameters are added one at a time byRequest.withQueryParam(name, value), each encoded byUrl.encode(so a space is%20, not+), joined with?or&and placed before any fragment, by text on the request’s URL, which is parsed only when sent. Why: the cheapest form that reads well in a chain and needs no parse that could fail at build time. Alternatives weighed: aqueryparameter on every verb (a fifth parameter onpost/put/patch); aUrl.withQueryParam(useful too, but not needed for a request); form encoding with+(onlyapplication/x-www-form-urlencodedbodies need it). Review with the user: whether the verbs should also take aqueryvector. -
Settled on the user’s delegation 2026-11-12 (built on branch
http-verbs):Response.json(status, text: string)takes JSON already written and sends it asapplication/jsonwithout checking it. Why: JSON lives in a package today (moving to the standard library asavin.json), andavin.net.httpmust not depend on a package; a text overload needs nothing. (JSON stays a package,dev.avinlang.json, by the user’s decision of 2026-11-13, so the text overload is the only one; a program passesvalue.render.) Alternatives weighed: leavingResponse.jsonout until then (every JSON handler spells the content type by hand);charset=utf-8in the type (RFC 8259 defines none forapplication/json). Review with the user: theJsonoverload onceavin.jsonlands. -
Settled on the user’s delegation 2026-11-12 (built on branch
path-helpers): Paths are strings, and the path functions live inavin.fs(branchpath-helpers, 2026-11-12). Proposed: noPathtype;fs.join,fs.parent,fs.fileName,fs.extension,fs.stem,fs.normalize,fs.relativeTo,fs.components,fs.isAbsolute/isRelativetake and answerstring, bound tosysl.path, and sit inavin.fsbeside the calls they feed. Why: every call ofavin.fs,avin.processand the rest already takes astring, so a type would mean a conversion at every call or a second overload of each; everystringmethod applies to a path as it is; the separators and dots the functions look at are ASCII, so working on UTF-8 text is exact for any name. Alternatives weighed: aPathclass with/and methods (p.parent), which reads well but splits the library in two; a separateavin.pathmodule, which a program’s ownpathvariable shadows at once (fs.joincannot be shadowed by a local of that name). Review with the user: whether aPathtype is wanted after all. -
Settled on the user’s delegation 2026-11-12 (built on branch
path-helpers):walkanswers a sorted vector, with an unreadable directory as an entry (branchpath-helpers). Proposed:fs.walk(root) -> Result[Vector[Entry], IoError], depth first, a directory before its contents, each directory’s names in code-point order (aslistDir), the root itself left out;Entry(path, relative, depth, isDir, isLink, error). A link is listed and never followed (isDirfalse for it), the root is followed when it is a link, and a directory that cannot be listed is an entry whoseerrorholds the reason, the walk going on past it; only a root that cannot be listed makes the whole walk anErr. Why: one?at the call and an ordinaryforover the answer, deterministic order for tests and tools, no entry silently lost and no permission problem deep in a tree spoiling the rest. Alternatives weighed: a lazy iterator ofResult[Entry, IoError]with pruning (sysl’s shape: cheaper on a huge tree, but every item needs its own?and the order is the file system’s); failing the whole walk at the first error; skipping unreadable directories silently; following links with cycle detection. Review with the user: whether a lazy walk with pruning is wanted for very large trees. -
Settled on the user’s delegation 2026-11-12 (built on branch
path-helpers): Pattern matching is by character, andglobignores what it cannot read (branchpath-helpers). Proposed:fs.matches(pattern, path)is written in Avin rather than bound tosysl.path.matches:?and a class take one character, so?.txtfits文.txt. Pattern and path are compared component by component (doubled and trailing/do not matter, an absolute pattern fits only an absolute path);**as a whole component is zero or more components; a name starting with.is fitted only by a component starting with a literal.(not?,*or[.]), and**does not pass through one; an unclosed[is a literal[and a trailing\a literal\, so every pattern is valid andmatchesnever fails.fs.glob(pattern) -> Vector[string]expands component by component, answers sorted and without repeats, follows a link named by a literal or wildcard component but not under**, and treats a directory it cannot read as empty. Why: Avin strings are characters, and a byte?would match a third of文; component-wise matching makesglob‘s answers fitmatchesby construction; the shell’s hidden-name rule keeps**out of.git. Alternatives weighed: binding sysl’s byte matcher (one third of a character per?); anErrfor a malformed pattern (aResulton everymatchescall for a case a literal reading answers);globansweringResult(an error deep in a tree would lose the rest, as withwalk, and a pattern has no single directory whose failure should be the answer). Review with the user: brace alternatives{a,b}, left out. -
Settled on the user’s delegation 2026-11-12 (built on branch
path-helpers):isDirandisFileaskstat(branchpath-helpers). Proposed:fs.isDirwas bound tosysl.fs.is_dir, which opens the path as a directory, so a directory the program may not read answeredfalseandisFile(exists && !isDir) answeredtruefor it; both now read the samestatasmetadata. Why: the chapter saysisDiris whether the path names a directory, andwalkneeds the kind of an unreadable directory to report it. Alternatives weighed: keeping the opening check (a permission answer dressed as a kind). -
Settled on the user’s delegation 2026-11-12 (built on branch
text-papercuts):sortedDescendingon everySeqofOrdelements (aList‘s answering aList), andsortInPlaceDescending()on arrays, buffers and deques, besideReverse, which stays the way to sort descending by a key. This amends the settledReverseentry, which had chosen nosortedDescending. Why: the whole-element case is the common one (top scores, largest files),sortBy(x -> Reverse(x))is a detour for it, and the obvious spelling a program reaches for instead,sorted.reverse, is quietly wrong for elements that compare equal but differ, since it turns their order round; a stable descending sort keeps it. NosortByDescending: a key turned round isReverse(key), which also composes inside a tuple key, so a second spelling would add nothing. Alternatives weighed: keepReversealone (the settled choice; the gap audit’s programs did not find it);sortByDescending(key)as well (two ways to write one thing); adescendingflag onsorted(a boolean argument reads poorly at the call). Review with the user: it reverses a settled choice. -
Settled on the user’s delegation 2026-11-12 (built on branch
text-papercuts): the,format flag groups a decimal integer’s digits in threes with commas, under%dand%ionly; under every other conversion it is the “has no effect” error. The zeros of a precision are grouped with the digits (${5}%,.6dis000,005), but the zeros of the0flag are not: they fill the width before the grouped digits, the commas and the sign counting in it, so the field is never wider than asked unless the number is (${1234}%0,8dis0001,234,${-1234}%0,8dis-001,234).FormatSpecgainsgrouping: bool = falseas its last field, so code that builds one by position is unchanged. Why: a width is a column’s width, and a column that a comma can widen by one does not line up; precision zeros are digits of the number, fill zeros are padding. Alternatives weighed: grouping the fill zeros too, added until the field is full (0,001,234for width 8: one wider than asked);_or a locale’s separator (no locale exists; a comma is the common reading); allowing,under%f(a real’s grouping is a separate item, not asked for yet). Always a comma, never locale-dependent. -
Settled on the user’s delegation 2026-11-12 (built on branch
text-papercuts):string.utf8answers a newArray[byte], a parameterless member asbytesis, the array the caller’s own on every call. Why: files, sockets and request bodies take anArray[byte], ands.bytes.toArray()built a vector only to copy it. Alternatives weighed:toUtf8()with parentheses (it is a pure conversion, so the parameterless rule writes it bare); answering a frozen, shared view (anArrayis mutable, so sharing would let one caller change another’s bytes). -
Settled on the user’s delegation 2026-11-12 (built on branch
dot-chain): a line that starts with a member’s., indented deeper than the line its expression began on, continues that expression, exactly as a line starting with a binary operator does: in the same places (a binding’s value, an assignment, areturnvalue, an infix call’s argument, amatcharm’s or a lambda’s body, a branch of a one-lineif, an expression statement, a trailing lambda’s body), never in the header of a form whose body follows, with blank lines and comments between skipped, and ending at the first line back at the depth the expression began on..and the binary operators may alternate line by line, and a call’s trailing block ending inside the chain lets the next.line go on after it. The line break means nothing to binding:.takes the operand right before it, soa + bthen.toStringisa + b.toString, as on one line. An indented line after a call that starts with.is a continuation, not the call’s trailing block. The error for a line inside a continuation that starts with neither now says “a binary operator or.“. Why: a pipeline offilter,mapand a builder’s.get(…)calls reads one step per line, and wrapping it in parentheses to get there was the only way before (audit item C2; thelwt-serverrouting entry chose a vector over a builder for this reason). Reusing the operator continuation keeps one rule for where an expression may go on, and the line break meaning nothing keeps one rule for precedence. Alternatives: a.line binding to the whole expression above ((a + b).toString), which reads naturally for a chain after an operator but makes the line break change meaning, unlike every operator line; requiring a chain to start on its own line (val ys =then the receiver and the dots on deeper lines), which adds nothing the depth rule does not already say; a trailing.at the end of the line above, which hides the call being made. Review with the user whether.after an operator line should bind to the whole expression instead. -
Settled on the user’s delegation 2026-11-13 (built on branch
nothing-conversion): A function whose result isNothingconverts to one of another result where it is written, as a lambda calling it, and not inside another type (types; branchnothing-conversion). The subtyping rules already made(A) -> Nothinga subtype of every(A) -> R, but no function value of it was accepted where one was expected (only a lambda whose body never finishes, checked against the expected type), while an inferred type argument let one through with no conversion, and the call through the wider type then called code yielding no value as code yielding one. A call of aNothingfunction yields no value at all, and one of an(A) -> Ryields anR, so the two are laid out differently and one is not the other as it stands. The choice: at a declared type, an argument (after inference too), a result, a field, and the branches of anif/matchor elements of a collection literal, the value is evaluated once into a local and made a lambda of the expected type calling it (a named function is called by name and nothing is captured, so it may be@sendable); nested results (() -> () -> Nothing) convert one level at a time. Parameters keep their variance; aVector[(int) -> Nothing]is noVector[(int) -> int], as aVector[int]is noVector[Any]. Why: it gives the subtyping rule its meaning with no change to how functions are called, and matches how a value of a value type becomes anAnyor a trait (at the site, never inside a container). Alternatives weighed: a view with no conversion, the closure’s entry for aNothingresult answering every result’s layout (impossible in one entry: anint, areal, a reference and no value are returned differently); a dedicated adapter node in lowering (the same conversion, built by hand rather than as a checked lambda); refusing the conversion and keeping only lambdas (contradicts the subtyping rule, and the inferred case had to be closed anyway). Review with the user: whether a function held inside a collection should convert too, which needs a copy of the collection. -
Settled on the user’s delegation 2026-11-13 (built on branch
numeric-widths): numbers havetoInt,toLongandtoRealas parameterless members, each exactly the conversion call of its type. Every integer type hasn.toIntandn.toLong(int(n),long(n): a narrowing one traps when the value does not fit, as the call does);realhasx.toIntandx.toLong(int(x),long(x): truncation toward zero, saturation at the bounds, NaN to zero);toRealwas alreadyNumeric‘s. They are members of the integer family’s impl and ofreal‘s, not ofNumeric, so a number type of a program’s own owes onlytoReal. WHY:string.toLong()andxs.sum.toRealput conversions where a reader reaches for them, andn.toLongansweringint has no field `toLong`was the surprise; making the member the call, rather than a second semantics, keeps one rule for what a conversion does. A narrowingtoInttraps, asstring.toInt()traps on a number that does not fit and asint(n)does, so the trap/Optionsplit stays where it is (toIntOption()is for text, whose failure is the input’s). ALTERNATIVES: no members, only a hint naminglong(n)(leavestoRealthe odd one out); a narrowingtoIntansweringOption[int](differs fromint(n)and fromstring.toInt()); no narrowing members at all,toLongonly (anintfrom alongis as common as the reverse); members onbytetoo (a byte is not a number, andint(b)reads as what it is). Review with the user: whetherreal.toIntshould trap on NaN and out-of-range values instead of saturating, asstring.toInt()traps on text that is no number. -
Settled on the user’s delegation 2026-11-13 (built on branch
numeric-widths): mixed-width arithmetic stays an error, and its diagnostic names the conversion, pointing at the operand to convert:error: `*` needs two numbers of one type, not long and int; write `long(n)`, the operand quoted as written (or, when it is longer than 40 bytes or spans lines,convert the int with a call of `long`). The narrower integer converts to the wider, an integer or a byte toreal, a byte to an integer, an integer to a type parameter bounded byInteger(T(n)), and a value of aNumericparameter torealbyx.toReal. Comparisons (<,==, …, each link of a chain) say the same. A compound assignment’s target keeps its type, so there the value converts to it, a narrowing call included (n -= totalsuggestsint(total)). Acharbeside a number gets no conversion hint: it is no number, and'-' * 3meantrepeat. WHY: the spec settles that integers are never widened implicitly; the error was right and only lacked the fix. ALTERNATIVES: implicit widening (contrary to the settled rule); pointing at the whole operation (the hint names one operand, so the caret should too); suggesting a narrowing of the wider operand (loses values). -
Settled on the user’s delegation 2026-11-13 (built on branch
diag-spans-recovery): Parse recovery and the hints forMap(k -> v)and an argument’s type (branchdiag-spans-recovery). A line of a block, class, actor or machine the parser cannot read to its end is skipped to the next line, and reported only when nothing in it was reported already; an argument list or parenthesized group meeting a token other than,or)reports it once and skips to its).->there says “write a map as{"a": 1}“ when the callee’s name ends inMapand “->does not pair two values: write a pair as(a, b), and a map as{"a": 1}“ otherwise; and “a lambda’s parameter with a type is written in parentheses” when: T ->follows a name. WHY: one mistake made five to ten errors, each naming a token rather than the mistake, and the token shows exactly which mistake it is. ALTERNATIVES: suppressing every error after the first in a statement (panic mode), which also hides a genuinely separate mistake on the same line; acceptingk -> vas a pair (a second spelling of a tuple, andx -> bodyis a lambda). The hints this entry first gave forx: Tin an argument or a group (“give the type argument instead”, “declare the value with it”) are gone:x: Tthere is now a type ascription (the user approved ascription 2026-11-13). -
Settled on the user’s delegation 2026-11-13 (built on branch
diag-spans-recovery): A member’s mistake is shown at the member (branchdiag-spans-recovery). The checker reports a missing or private member, an argument-count mistake and()on a parameterless member at the member’s name and argument list; the call’s own span, used for a type mismatch and for traps, stays the whole expression. WHY: in a chain written over leading-.lines the whole span starts lines above the member at fault, and the rendering shows only its first line. ALTERNATIVES: narrowing the call’s span itself (a wrong-type value would then be shown at its last member only); storing the name’s span in the syntax tree (everyMembermatch changes, for a span the source already determines). -
Settled on the user’s delegation 2026-11-13 (built on branch
argparse):avin.cli: a declared parser read by name (branchargparse). Proposed: the standard library’s argument parser is aParservalue built by chained declarations (flag,string,int,real,choice,positional,positionals, each with namedshort,help,default,required,repeated,value), andparse(args)answersResult[Args, ArgsError]; values are asked for by name and type (a.int("top"),a.strings("file")), and asking for an undeclared name or the wrong type traps.parseOrExitcovers the usualmain: help or version to standard output and status 0, a mistake to standard error with the usage line and status 2. Why: it needs no language feature, a program reads in the order its help does, and every mistake a user can make is a value with a sentence naming what they wrote. Alternatives weighed: deriving a parser from adatatype’s fields (data Options(...) derives Args), which checks names at compile time but needs a derivation and a way to attach help, short letters and defaults to fields; a getopt-style loop the program drives, which is whatwchand-rolled; one getter returningOptionfor everything, which makes every read amatch. Review with the user: whether a derived form is wanted on top of this one. The rules it settles, each the common command-line convention:--name=valueand--name valuealike; bundled letters (-lw,-n5,-lwn5); an option’s value is the next argument whatever it starts with (--top -1);-alone and the empty argument are positional;--ends the options; options and arguments interleave; a single option given twice keeps the last (so an alias’s option can be overridden), arepeatedone keeps all, and a flag is counted (-vvv). Every parser has--help/-h, and--versionwhere it has a version, unless the program declares that name or letter itself; each acts where it stands, left to right. An option with nodefaultreads as its type’s zero ("",0,0.0) andgiven(name)tells whether it was on the command line; the help shows a default only where it is not that zero, since a default parameter cannot tell an explicit zero from an omitted one. Every option has a long name (the nameArgslooks it up by); positional arguments are strings. The reasons readunknown option `--x`,`--count` needs an int, not `abc`and`--scale` needs a number, not `x`(a user of the program knows “number” better than “real”). Alternatives weighed: refusing an option given twice (catches typos, breaks overriding an alias); refusing a value that starts with-unless it is a number; typed positional arguments, left out until a program needs one;Option-typed defaults (default = Some(3)), exact but noisy at every declaration. -
Settled on the user’s delegation 2026-11-19 (built on branch
cli-subcommands):avin.clicommands are parsers of their own.Parser.command(sub)adds the commandsub.name, whose options and argumentssubdeclares and whose help line issub.about; a command may have commands (git remote add). The first positional argument names the command and every argument after it is the command’s, so the program’s options come before the command word and the command’s after it (todo --file t.txt add -p high milk); a parser with commands takes no positional arguments, and declaring both traps.Args.commandis the command’s name (empty where the parser has none) andArgs.commandArgsthe command’s ownArgs. While a command reads its arguments its parser is named after the program and the command, so its usage line, help and messages saytodo add. Every parser with commands has the commandhelp(todo help add,todo help remote add) unless the program declares one of that name, as with--help;todo add --helpis the command’s own. No command ismissing command; the commands are `add`, …; an unknown one isunknown command `lst`; did you mean `list`?, the suggestion being the nearest name within two edits (fewer than the word’s characters), else the one name the word begins, else the list of commands. WHY: a sub-parser is the value a program already knows how to build, so a command needs no new kind of declaration, and nesting comes free; reading only the program’s options before the word is the convention every tool with commands follows, and keeps a command’s options free to reuse the program’s names. Alternatives weighed:command(name, help, sub)(repeats whatsubalready holds); a dispatch table of functions (command(sub, run)) thatparsewould call, which hides control flow and fixes a return type on every command; options of the program accepted after the command word too (ambiguous where both declare a name); a missing command printing the help instead of a mistake; matching commands by unique prefix outright (todo lrunninglist), which turns a later command into a breaking change. Review with the user: whether a missing command should show the help (git’s way) rather than be a mistake. A mistake is reportable without ending the program.ArgsError.Invalidgainsprogram(the name of the parser that found it,todo add) andhint(Run `todo add --help` for the options.,Run `todo --help` for the commands., orhelpwhere--helpis the program’s own, or empty), soInvalid(reason, usage, program, hint);ArgsError.reportis the whole textparseOrExitwrites, every line ending in a newline, andexitCodeits status (0 for the help or the version, 2 for a mistake). A shell or script runner callsparse, writese.reportand reads the next line;messageand theDisplaystay the reason alone, so anArgsErrorpassed on with?still reads as one sentence. WHY: the error must carry the failing command’s name, since only it knows it; a parser methodreport(e)would name the top program for a command’s mistake. Alternatives weighed: keepingInvalid(reason, usage)and folding the name intousage(changes what the field means); making theDisplaythe whole report (a multi-line display breaks error chaining). Review with the user: the two new fields changeInvalid‘s shape, so a program matchingInvalid(reason, usage)must add_, _. -
Settled on the user’s delegation 2026-11-13 (built on branch
small-papercuts): one family of case names,toUpperandtoLower, forcharandstringalike.string.toUpperCaseandtoLowerCaseare renamed totoUpperandtoLower, the namescharalready had, across the library, its tests, the corpus, the scripts and the spec;"a".toUpperCaseis refused withstring has no field `toUpperCase`; a string maps its case with `toUpper` and `toLower`, as a `char` does. WHY: one name for one operation on both types, and the shorter one, which conflicts with nothing on either type. There is no deprecation mechanism to keep the old names as aliases, so the old names are gone and the error names the new ones. ALTERNATIVES: renamechar‘s totoUpperCase(longer, andisUpper/isLoweroncharwould then disagree with it); keep both names onstringas plain aliases (two names for one method forever, with no way to retire one). Review with the user: it breaks source using the old names (marshal, tui and typing-practice use them), so their call sites change in the release that carries it. -
Settled on the user’s delegation 2026-11-13 (built on branch
small-papercuts):avintakes its options before or after the program. The program is the first argument that is neither an option nor an option’s value, wherever it stands beforerun‘s--; foravin test, only an existing path is the program and any other word is the filter, as before.avin run -O2 main.avin,avin run main.avin -O2,avin -O2 main.avinandavin build -o out -O0 main.avinare all accepted, and only what follows--reaches the program. A first argument that is any option (not only-O0,-O2or--) now meansavin run, which checks the options itself. WHY: the audit’savin run -O2 file.avinprinted the whole usage; the order of avin’s own options carries no meaning, and--already separates the program’s arguments. ALTERNATIVES: options after the program only, with an error saying so (keeps a rule nobody needs); treating words after the program as its arguments without--(makesavin run main.avin -O2pass-O2to the program, which surprises in the other direction). One exception, from branchscript-deps(below):avin <file> ..., with no command word, for a file whose first line begins#!, gives every argument after the file to the program, since that is how a#!/usr/bin/env avinline runs it as a command. -
Settled on the user’s delegation 2026-11-13 (built on branch
small-papercuts):Result.toOptionbesideok, andStringWriterisDisplay.toOptionanswers exactly whatokdoes, under the nameEitherand the collections use;okstays.StringWriterimplementsDisplay(itstext, padded to a field’s width, as a string) andtoString()returns itstext. WHY: the names people reach for first, and a writer that interpolates as what it holds. ALTERNATIVES: renamingoktotoOption(breaks callers for no gain;ok/errread as a pair); aStringWriterwithtoString()only (it would still show as its type’s name ins"$w"). -
Settled on the user’s delegation 2026-11-13 (built on branch
small-papercuts):t._1on a tuple names the part to write. A member_followed by decimal digits asked of a tuple adds; a tuple's parts are numbered from 0, so write `.n-1`when1 <= n <=its arity, and; a tuple's parts are numbered from 0 and read as `.0` to `.k`otherwise (_0, a part beyond the arity, a number too large to read). WHY: the_1spelling is what readers of other notations write first, and_nmeaning partn - 1is the likely intent. ALTERNATIVES: accepting_1as a second spelling (two ways to write one thing). -
Settled on the user’s delegation 2026-11-13 (built on branch
build-dir):avin runandavin testbuild into the user’s cache directory, not into.avin/beside the program. A program’s executables and its instance cache go tobuild/<name>-<key>/in the toolchain’s cache (~/Library/Caches/avin/<version>/on macOS,$XDG_CACHE_HOME/avin/<version>/or~/.cache/avin/<version>/elsewhere, orAVIN_CACHE), where<name>is the program’s directory’s or file’s name and<key>twelve hex digits of a SHA-256 of its absolute, canonical path..avin/build/beside the program is used only on a machine with no cache directory (noAVIN_CACHE,HOMEorXDG_CACHE_HOME; the runtime’s archives then go to the temporary directory, which is cleared under a long-lived cache).avin buildand-oare unchanged. The newavin clean [<program>]removes the program’s directory and any.avin/build/beside it (on the fallback, a program of one file’s entries only, and.avin/once empty);avin clean --allremoves the wholebuild/of this version and nothing else of the cache, and on the fallback means the current program’s.avin newwrites/<name>(the executableavin buildleaves at the root) and.avin/into an application’s.gitignore,.avin/alone into a library’s. Why: a one-file script run from anywhere left an.avin/next to it; Sysl keeps its builds and run cache in the machine cache directory keyed by version and target and uses a project’s.sysl/only where there is none, and Avin already keeps its fetched packages, runtime archives and shims there, so a build cache beside the source was the one exception. Keying by path keeps two worktrees of one repository apart (each has its own sources), and the version in the path keeps one compiler’s entries from another’s. The executables and records are still published by rename and the instance cache is lock-free as before, so two builds of one program at once stay safe. Alternatives weighed: keep.avin/beside projects and move only one-file programs (two rules to explain, and a repository still grows a directory to ignore); key by the program’s content rather than its path (every edit would start a new cache, and nothing would ever trim the old);--allremoving the wholeavin/<version>(it would also drop fetched packages, which a build then fetches again over the network); a lock around a program’s cache (the content-addressed, rename-published entries need none). Review with the user: whether a cache of a deleted project should ever be trimmed on its own (answered by the cache’s limit: least recently used first, see the Proposed entries of branchcache-trim). -
Settled on the user’s delegation 2026-11-13 (built on branch
variant-test-open): A variant with fields named alone in a pattern tests for the variant and binds none of its fields.o.status is Shipped,Shipped -> …in amatcharm,Status.Shippedqualified,Some(Shipped)nested andf(Shipped) = …in a clause all meanShipped(_, _), with the variant’s own number of_; coverage and unreachable arms treat it as that pattern.Shipped(), written with parentheses, is still matched against the fields by number and refused for a variant that has some. Why: the commonest test of a variant asks only which one it is, and counting_s to say so is noise that changes whenever a field is added; the previous error suggestedShipped(fields), which is not Avin, and the bare name could mean nothing else, since a variant in scope is never a binding. One rule for every place a pattern goes, becausex is Ptakes exactly the patterns amatcharm takes. Alternatives: only inis(two pattern languages, and amatcharm refactored from anif … iswould break); keeping the error and suggestingShipped(_, _)with the right number of_(valid, but the test still has to change with the fields). Review with the user: a reader may takeShippedfor a variant without fields. -
Settled on the user’s delegation 2026-11-13 (built on branch
variant-test-open):open,abstractandoverridewhere they mean nothing are one error each, and the declaration then parses as written. Before a method: “a method takes noopen: every public method of anopenorabstractclass, and every method of a trait, may be overridden already; removeopen“, and forabstractthat a method declared without a body is abstract already; before a field, that a field cannot be overridden or is abstract by having no value; before a top-level function, that it belongs to no class or overrides nothing; beforetrait,dataandobject, why each takes none;override class, that a class replaces nothing and extends with: Base. Why: the words were read as names, soopen sound() -> stringreportedopenandstringas undefined and then every override ofsoundas overriding nothing. The spec settles that every public method of an open class may be overridden, so methods have noopento accept. Alternatives: acceptingopenon a method as a harmless no-op (two spellings of one meaning); a method-levelopenwith classes’ methods final by default (a language change the settled rules do not ask for).open(…),open = …and a method namedopenkeep their meaning: the word is a modifier only before a name or a declaration keyword. -
Settled on the user’s delegation 2026-11-13 (built on branch
bigint):BigIntis a class of the core moduleavin, written in Avin, its magnitude in limbs of nine decimal digits held inlongs. It is visible with no import, asBitSetis; its limbs are aFrozenArray[long], a type no program can name, so its constructor cannot be called with a malformed magnitude from outside the library, and the value is immutable and sendable. Multiplication is schoolbook and division is long division with a normalized divisor, both quadratic. Why: base 10^9 makes decimal text, by far the commonest, a limb at a time in both directions, and keeps a limb product plus a carry inside alongwith no wrapping arithmetic; living inavinlets it reuse the integer formatter’s private layout code, so%dand its flags behave exactly as forlong. Alternatives: binding Sysl’ssysl.math.bigintthrough a handle (faster, but its behaviour, text forms and traps would be Sysl’s to change, and the library is meant to be Avin); base 2^32 limbs (cheaper bit operations, whichBigIntdoes not have yet, but every decimal conversion becomes a division per nine digits and products need wrapping or 128-bit arithmetic); a moduleavin.mathneeding an import (keeps the core namespace smaller); Karatsuba multiplication (not needed at the sizes programs meet so far). Review with the user: whetherBigIntshould be in the core namespace, and whether it should gain the bitwise operators and shifts. -
Settled on the user’s delegation 2026-11-13 (built on branch
bigint):BigInt‘s API mirrors the integer methods:abs,sign,pow,gcd,lcm,floorDiv,floorMod,toRadix(r), plusisZero,divRem,toLong/toIntthat trap andtoLongOption/toIntOptionthat answerNone. Made byBigInt(n)from any integer width (a non-genericapply(n: long)beside the generic one, so a literal as large as alongis accepted),BigInt(text)/BigInt(text, radix)that trap on bad text astoLongdoes (For input string: "…"), andBigInt.parse(text[, radix])answeringOption. A zero divisor traps withdivision by zero. Why: one vocabulary for whole numbers, so code moves betweenlongandBigIntby changing a type; the trapping andOptionpairs followstring.toLong/toLongOption. Alternatives:toString(radix)instead oftoRadix(the integer types already chosetoRadix); onlyOptionconversions (forces.getat every call that knows the value fits); astring.toBigIntextension (adds to every string a method for one type). -
Settled on the user’s delegation 2026-11-13 (built on branch
bigint): the integer format conversions%d,%i,%x,%X,%oand%btake aBigInt, and%srefuses it as it refuses every number. The checker names the core library’sBigIntbeside the integer widths andbyte. Why: a whole number is formatted as one, with grouping, signs, zero padding and bases; refusing%skeeps the rule that a number’s conversion says how its digits are laid out. Alternatives: a trait (sayWholeNumber) a type implements to be taken by the integer conversions (general, but a new trait and a display contract for one type); acceptingBigIntunder%s(inconsistent with every other number). Review with the user: whether a trait should open the integer conversions to other types. -
Settled on the user’s delegation 2026-11-13 (built on branch
bigint): a type’s static member is called on its name even where the type has a companion object.Cup.zero()withobject Cupdeclared reported “Cuphas no memberzero“ (andPeriod.zero()the same), since the name was read as the object. NowName.memberis the companion’s where the companion declares a member of that name, and otherwise the type’s static member where it has one, for classes and data types, written with type arguments or not, called or named as a function value. Why: the spec calls a static member on the type’s name, and a companion is where a type keeps its factories, so a type with both is the ordinary case (BigInt.zero()besideBigInt.apply). Alternatives: refusing a static member and a companion on one type (rules out the common case); the type’s static member winning over the companion’s member of the same name (makes a companion unable to shadow it deliberately). -
Settled on the user’s delegation 2026-11-13 (built on branch
json-package): the corpus programs that test the compiler with JSON depend on the sibling checkout~/dev/avin-lang/jsonby path (../../../../../jsonfromtests/programs/{run,reject}/NAME/). Why: the corpus loads packages without fetching, and a copy of the package inside this repository would drift from the real one; the compiler already reaches~/dev/sysl-lang/parsingthe same way. Alternatives: a vendored copy undertests/packages/json(self-contained, but two sources of one package); a git dependency (the corpus does not fetch). Review with the user: it makes the avin gate need the json checkout beside it. -
Settled on the user’s delegation 2026-11-13 (built on branch
json-package): a trap inside a package is placed in the package’s source, as before for any module that is not the core library:j("absent")now reportsat json.avin:98:9where, asavin.json, it reported the program’s call. The corpus programsjson_missing_key_trapandjson_missing_index_traphide the package’s line and column. Why: the rule that a trap is placed where the program last called in is the core library’s (errors), and widening it to every dependency is a design change of its own. Alternatives: placing a trap at the last call from the root package’s own code (better for a package’s users, worse for its author debugging it); a per-package opt-in. Review with the user: a package’s user would usually rather see their own call. -
Settled on the user’s delegation 2026-11-13 (built on branch
script-deps): A program of one file names its dependencies in a header of comment lines at its top: the line// avin.hocon, then//lines whose text after the//is exactly a manifest’sdependenciesblock, ending at the first line that is not a//comment (packages). Why: domain libraries are packages (JSON, CSV), and a script must reach them without becoming a directory with a manifest; reusing the manifest’s own HOCON means one syntax, one parser and one set of errors, shown at the header’s line in the file. Being comments, the header needs no change to the lexer, the parser, the formatter or the IntelliJ plugin, and a file with one is still Avin to every tool.// avin.hoconreads as “this file’s manifest”, and the editor grammar colours the block as embedded HOCON. Alternatives weighed: a---front-matter fence (a second lexical form every tool must learn, and a file no older compiler reads); a declaration in the language,dependencies { … }or an annotation on the file (dependencies are the build’s business, not the program’s, and the checker would have to ignore it); one@dep("github.com/…@1.0")comment per dependency (a second syntax for what a manifest already says, withoutpath,rev,memberor features); a block comment (Avin has none). Review with the user: the marker’s spelling. -
Settled on the user’s delegation 2026-11-13 (built on branch
script-deps): The header holdsdependenciesonly, and is at the top or refused.workspace = trueandoptionalare refused (no workspace, no features of its own);package,features,sysl-dependenciesandc-librariesare refused at the key, a program that needs them being a package. It begins on the first line, or the second after a#!line; a// avin.hoconline anywhere else is an error, because a header silently not read is a missing dependency reported as an unknown module. Alternatives weighed: allowingsysl-dependenciesandc-libraries(each works through the same resolution, and may be added when a script needs one); allowing other comments or blank lines before it (a header that moves is harder to find, and the rule “first line” is one a reader can check at a glance). -
Settled on the user’s delegation 2026-11-13 (built on branch
script-deps): A header in a file of a package, or of a program of many files, is refused at the header, rather than merged with the manifest or passed over. Why: two places naming a package’s dependencies would disagree, and passing it over hides a mistake; a directory program has no manifest, and the way to give it dependencies is to make it a package. Only the package’s own files are checked; a dependency’s files are not. -
Settled on the user’s delegation 2026-11-13 (built on branch
script-deps): A program of one file’s sum file is beside it, named after it:tool.avin.sum, written and checked asavin.sumis, absent when nothing is fetched, rewritten byavin tidy tool.avin. A program of one file is not vendored:avin vendorrefuses it, andavin add(which edits a manifest) refuses it too. Why: the sum file is where a manifest’s is, beside what names the dependencies, and naming it after the file lets several scripts share a directory. Avendor/beside the file would be shared by every script in the directory, and vendoring one would remove the others’ packages. Alternatives weighed: no lock at all, trusting the cache’s recorded hash (a moved tag would go unnoticed on a second machine); oneavin.sumper directory (scripts would add andtidywould remove each other’s lines); the hashes written into the header (the build would rewrite the user’s source); avendor/<file>/per script. Review with the user: whether a script’s sum file is wanted, or is clutter next to a one-file tool. -
Settled on the user’s delegation 2026-11-13 (built on branch
script-deps): A first line beginning#!is not Avin, in every file, and the line is written#!/usr/bin/env avin.avin <file> ...(the form a#!line runs, with no command word) for a file whose first line begins#!gives every argument after the file to the program, so./tool.avin -O0 xpasses-O0andx. Every other form keeps the command line’s rule:avin run tool.avin -O0 -- xandavin -O2 tool.avin -- xtake the options as avin’s and pass only what follows--. Why:./tool.avin a brunsavin ./tool.avin a bthrough the#!line, and without the rule the program’s arguments would need a--that a command’s caller cannot know to write; while a person typingavin runis using avin, and its options mean the same wherever they stand. Alternatives weighed: every argument after any#!file the program’s,avin runincluded (the branch’s first form; it madeavin run tool.avin -O0mean something different for one kind of file);#!/usr/bin/env -S avin runas the line (needsenv -S, and runs throughavin run, where the options are avin’s);#!lines needingavin run --(env passes the file after the--, so it would be an argument, not the program); taking options before the first non-option and the rest as the program’s (./tool -O0would still be eaten). Review with the user: the argument rule, which makes-O0after a#!file the program’s when run as a command. -
Settled on the user’s delegation 2026-11-13 (built on branch
fmt-pack):avin fmtfills a broken literal of short, simple items, as many to a line as fit (branchfmt-pack). A sequence literal[…]or set literal{…}(brackets not after an operand, so no index or type arguments) whose every item is a number, a character, a plain string,true,falseor a name, a number with a sign against it included, and no item wider than 32 characters, is broken where any list would be (past 120 characters, or written with a line break after its opening bracket and before its closing one), but its items are then laid out,-separated, as many to a line as fit in the 120 columns, two columns in, a trailing comma kept after the last. Any other item (a call, a lambda, a tuple, a nested literal, an interpolated string, akey: valueentry) keeps the one-item-per-line layout, and a comment among the items keeps the lines as written, as everywhere inside brackets. Arguments of a call are never filled. The result is idempotent: a filled literal is broken after its opening bracket, so formatting it again fills it the same way. WHY: a generated table (tui’swidth_table.avin, about 640 pairs of code points) became ~1,280 lines of one number each; filled, it is 111 lines and reads as a table. ALTERNATIVES: keep a source that is one per line one per line (leaves the table unreadable, and a table that has been throughfmtonce could never recover); fill any list of one-token items, call arguments included (a call’s arguments are each a meaning, and one per line shows them); fill short tuples(a, b)too (more rules for the reader of the style to learn; a table of pairs is written flat, as tui’s is); align items into columns (wider diffs for one changed entry, and no gain for numbers of one width). Review with the user: the 32- character limit, and whether a short list deliberately written one per line should stay so. -
Settled on the user’s delegation 2026-11-13 (built on branch
discarded-result): A droppedResultorFutureis an error, and_ = edrops one on purpose (errors). A value of either type is reported where it is thrown away: a block’s statement, the last line of a function or lambda yieldingunit, a branch of anifwithoutelseor of anif/matchwritten as a statement, a loop’s body._ = eevaluateseand keeps nothing. A deferred statement is exempt, and so is an expression the checker reads only for its own errors after the form around it failed. The standard library’s call sites were each handled or marked_ =(a socket or pipe closed once its exchange is over, a temporary directory removed, a signal to a program that may have ended).- Why:
fs.writeText("/nonexistent/x", "hi")as a statement compiled and failed silently (gap audit C8). An error, not a warning: Avin has no warnings channel, every diagnostic is an error, and a warning shown only sometimes is the one that is missed (as for unreachable match arms)._ = eis the spelling a reader already knows from destructuring, where_drops a part. A deferred statement is exempt because it runs while its block is being left, where no?orreturncan carry a failure anywhere, anddefer f.close()is the formdeferexists for. AFutureis included because dropping one loses its answer the same way. - Alternatives weighed: a warning (no channel to carry it); a
@mustUseannotation on types or functions (more general, but a new attribute for two types, and a library author could forget it);Resultonly (a droppedFuture[Result[…]]loses the failure just as surely); reporting a droppedResultindefertoo, which would makedefer _ = f.close()the idiom (noise on the one formdeferis for);val _ = eas the only discard (it already works, but reads as a declaration). - Review with the user: whether
defershould stay exempt (decisions above left “whether discarding aclose‘sResultindeferdeserves a warning” open), and whether a lambda yieldingunitshould be held to the rule (it is, soxs.foreach(f -> fs.remove(f))is an error).
- Why:
-
Settled on the user’s delegation 2026-11-13 (built on branch
bigint-natural): Integers meet a type that takes them, through a core traitFromInteger(2026-11-13, branchbigint-natural; types).trait FromIntegerwith one member,static fromInteger[N: Integer](n: N) -> Self;BigIntimplements it. (1) An integer literal where such a type is expected isT.fromInteger(literal), the literal typed as alongwhere it fits and otherwise at the narrowest width a multiple of 64 bits that holds it, so a literal of any size and base is aBigInt(val x: BigInt = 123456789012345678901234567890). (2) In+ - * / %, the comparisons and==/!=, an operand of an integer type (or a type parameter bounded byInteger) beside an operand of such a type is converted withfromInteger, on either side and in chains; a compound assignment converts only its value, so an integer target keeps its type. (3) Where the type has an operator method of the name and no overload of it takes an integer, its integer argument is converted, and a converted left operand calls it. (4) An integer literal is refused as a pattern for such a type, since its value is a call. WHY:f * i,f == 0andval f: BigInt = 1are what a reader writes, andBigInt(i)around every integer hid the arithmetic. One trait serves both rules and any later number type (a decimal, a rational) joins by an impl, with no type named in the checker; the conversion is lossless by the trait’s contract, which is why it is allowed where integer widths, which can lose, still needlong(x). A literal too large forlongreuses the arbitrary-width integers rather than a text form, so the trait has one member. ALTERNATIVES: operator methods onBigInttaking[N: Integer](coversbig * ionly;i * bigand0 == bigstill need a checker rule, so two mechanisms); a general reversed-operand lookup on the right operand’s type (larger, and it says nothing of literals or==); implicit conversion of an integer to aFromIntegertype at every expected type, arguments included (wider than asked, and it makes overloadsf(BigInt)/f(long)harder to read); afromDigits(text)member for literals pastlong(a second member every implementer writes, and a parse at run time). Literal patterns for such a type (matching by==) were left out: a pattern is a constant today, and coverage reasons about constants. Review with the user: whether the conversion should reach plain arguments (gcd(7)already works for a literal;gcd(i)does not), and whetherBigInt.zero()/one()should lose their()with the core traits’ wave. -
Settled on the user’s delegation 2026-11-13 (built on branch
bigint-natural):BigInt(n)with a literal pastlongstays an error (2026-11-13, branchbigint-natural):apply(n: long)andapply[T: Integer](n: T)give the literal no wider type, and the message says it does not fit;val x: BigInt = …is the spelling. WHY: typing a literal at a freeIntegerbound by its size would be a second literal rule for one call. ALTERNATIVE: anapplyoverload the literal rule reaches. -
Settled on the user’s delegation 2026-11-13 (built on branch
bigdecimal):BigDecimal: an immutable unscaledBigIntand a scale, rounding by aRoundingdata type, no context object (2026-11-13, branchbigdecimal; types). The class isBigDecimal(val unscaled: BigInt, val scale: int); a negative scale traps in the constructor, so a whole number is always scale 0 and a large one carries its zeros inunscaled.RoundinghasHalfEven(the default everywhere),HalfUp,HalfDown,Up,Down,CeilingandFloor, and no mode that traps on inexactness: the exact operation isexactDiv, answering anOption. Every rounding operation takes its precision positionally and its mode by name:round(places, rounding = …),roundSignificant(digits, rounding = …),div(o, scale, rounding = …),divSignificant(o, digits, rounding = …). WHY: one value type with its precision stated at each call reads plainly and has no hidden state; anOptionsays “may not be exact” in the type where a trapping mode would say it at run time. ALTERNATIVES: a context object or a thread-wide default (hidden state, the thing the user asked to leave out); anUnnecessarymode (a trap where a type can say it); a visible negative scale (1E+3as unscaled 1, scale -3: compact, but a second spelling of every whole number and a source of surprise inscale). -
Settled on the user’s delegation 2026-11-13 (built on branch
bigdecimal):/gives 34 significant digits, half to even, and an exact quotient within them at the “preferred” scale (branchbigdecimal). The quotient is rounded to 34 significant digits, then zeros after the point are dropped down to the dividend’s scale less the divisor’s (never below 0):1 / 4is0.25,6.00 / 2is3.00,1 / 3has 34 threes. So/agrees withexactDivwherever it is exact, anddivSignificantkeeps the same rule at its own digit count. WHY: 34 is the precision of a 128-bit decimal, enough for money and rates; padding every quotient to 34 digits (0.2500000…) would make/useless for display. ALTERNATIVES: a fixed scale for/(wrong for large and small magnitudes alike); refusing/and requiringdiv(the user asked for a default); no zero-stripping (the padded form above). -
Settled on the user’s delegation 2026-11-13 (built on branch
bigdecimal): Decimal literals reach a type through a core traitFromDecimal: FromInteger, with the literal’s text (branchbigdecimal; types).static fromDecimal(text: string) -> Selftakes the literal as written, sign and exponent kept and separators dropped;RealLitnow keeps its spelling for this. The parse happens at run time, each time the literal is evaluated. WHY: the literal is exact only if norealis ever made of it, and text is the one form every decimal type can read; the trait mirrorsFromInteger, so a program’s own decimal type joins by an impl. ALTERNATIVES: emittingBigDecimal(unscaledLiteral, scale)(exact and parse-free, but names one library type in the checker and serves no other); a compile-time constant pool (later optimization, not a language question). Review with the user: whether to hoist the parse once performance matters. -
Settled on the user’s delegation 2026-11-13 (built on branch
bigdecimal): ABigIntmeets a type that takes decimals byFromDecimal.fromBigInt(branchbigdecimal). The trait’s second member converts aBigIntoperand beside aFromDecimaltype under the five operators, the comparisons and==, either side, chains and compound assignment included, as an integer operand meets aFromIntegertype. A type that takes only integers takes noBigInt. WHY:price * qtywith aBigIntcount should read as written, and a type taking every decimal takes every whole number losslessly. ALTERNATIVES: afromBigIntmember onFromInteger(every integer-only type would have to write it, with nothing to build it from); converting throughfromDecimal(n.toString())(no extra member, but a text round trip on every operation); overloads onBigDecimalandBigInt(covers one pair of types, andBigIntwould have to knowBigDecimal). -
Settled on the user’s delegation 2026-11-13 (built on branch
bigdecimal): A real literal waits for the other operand only beside a value that is not a literal (branchbigdecimal). Inx + 0.5,0.5 + xandx < 0.5, the literal takesx‘s type, so aBigDecimalxmakes it one; among literals alone (1 + 0.5,1 < 2.5) everything is arealas before. WHY: the operand order rule integer literals follow, extended without changing a program that compiled. -
Settled on the user’s delegation 2026-11-13 (built on branch
bigdecimal): TheRoundingvariants are core names, seen everywhere (branchbigdecimal).HalfEven,Up,Down,Ceiling,Floorand the rest are variants of a prelude data type, sorounding = Floorneeds no import or qualifier. A program’s ownUporDownhides them where nothing expects aRounding, and where one is expected the bare name is stillRounding‘s, as forNoneandSome;Rounding.Upis always available. WHY: the call readsx.round(2, rounding = HalfUp), as asked. ALTERNATIVES: a moduleavin.mathforBigDecimalandRounding(an import for every program using money); prefixed names (RoundHalfUp). Review with the user: short common words such asUpandDownin the prelude. -
Settled on the user’s delegation 2026-11-13 (built on branch
bigdecimal):BigDecimal‘s smaller choices (branchbigdecimal): (1) the sign accessor issign, as onBigIntand the integers, notsignum; (2)round(places)always answers that scale, padding with zeros where the number has fewer places, and a negativeplacesrounds to tens, hundreds, … answering scale 0; (3)roundSignificantdrops one zero a carry adds after the point (9.99to 2 is10), while a whole number keeps the zeros it needs; (4)%anddivRemuse the quotient cut toward zero, the remainder taking the dividend’s sign, as onBigInt; nofloorDivyet; (5)toBigInt,toLongandtoInttake the whole part toward zero, asreal‘s do, trapping (orNone) only when it does not fit; (6)fromRealExactandfromRealShortesttrap on NaN and the infinities and answer the least scale that holds the value;fromRealExactwrites therealwith 1074 places through%f, which every finiterealfits exactly; (7)BigDecimal(text)andparseaccept.5,5.and an exponent, refuse separators and white space, and answerNonefor a resulting scale outsideint(a large positive exponent within it,1e100000000, is read, at the cost of its digits); (8)%ftakes aBigDecimalwith its precision as places, half to even, and with none keeps its own scale;%e,%g,%s,%dand,are refused; (9) the hash is the least-scale form’s, so equal values hash alike; (10)exactDivby zero traps, as every division does, sinceNonemeans “never ends”; (11)BigDecimal.zero()andone()are at scale 0; (12) mixing arealvalue with aBigDecimalis an error that namesfromRealShortestandfromRealExact. ALTERNATIVES weighed for each:signum(inconsistent withBigInt);roundnever adding places (thenround(2)cannot be used to show cents); floor division for%(different from every other%in the language); traps for fractionaltoLong(the whole part is what conversions take elsewhere);Optionfrom therealconversions (NaN is a programming error, not data); a%fdefault of 6 places (loses digits a decimal holds exactly).
Deferred
-
Path-dependent and intersection types; inferred unions; implicit parameters; macros.
-
Settled by the user 2026-11-13: Avin has higher-kinded types and a standard Functor, Monad and Traverse family, reversing their deferral; the design’s choices are under Proposed (branch
hkt-design), and the guiding rule the user gave with it is that Avin is the ultimate sound, nominally typed, compiled, garbage-collected high-level language: every rule is sound with no unchecked escape, the traits are nominal, andforcomprehensions admit their sources by conformance. -
Settled on the user’s delegation 2026-11-12 (built on branch
library-version): the standard library carries the compiler’s version, and the compiler refuses a library of any other.library/library.hocon‘spackage.versionis stamped byscripts/release.shin the same commit asconst Versionandcompiler/sysl.hocon, and a compiler checks it against its own before it compiles anything:check,build,run,testandlspprint one error naming both versions and the library’s path, and nothing else. A library with no version, or alibrary.hoconthat is missing or unreadable, is refused the same way. The rule is an exact match. A compiler built between releases carries the last release’s version, and so does the library in its own checkout, so a development build matches its own tree; only a library from another release, throughAVIN_ROOTor an install, differs. Why: a library of another version fails as dozens of errors insidelibrary/avin/*.avin, which points a reader at the library rather than at the mismatch. Alternatives weighed: a dev compiler accepting a library from the same commit (needs a commit id stamped into both and a build step that keeps them in step, to answer a case the exact rule already passes); “the library is newer than the compiler” (a newer library declares what an older compiler cannot check, which is the failure being fixed). Review with the user: whether a pre-release suffix should be accepted in the library’s stamp; manifests accept three numbers only, assysl.hocon‘s version does. -
Settled on the user’s delegation 2026-11-15 (built on branch
c1-diagnostics): A method declaredm()and named bare where a value is expected is reported as “mis called with(): writec.m(), or() -> c.m()for a function value”, the call first, written on the receiver as the program named it (a local or parameter by name,self, a type for a static member, nothing for a bare name’s implicitself),_.m()alone for a placeholder, and.m()with “a lambda calling it” for any other receiver. Why: the error is almost always a missing()now that pure accessors are declared without a parameter list, so the fix leads, and a fix written on the program’s own receiver is what the reader types; the old text (“is declared with an empty parameter list, so naming it without a call makes a function value, which is allowed only where …”) put the rule before the fix and showedx.m()for every receiver. Alternatives weighed: repeating a complex receiver’s source text (the checker holds no source text, and a long chain would crowd the message); keeping thex.placeholder (it names a variable the program does not have). The opposite message, forx.m()on a parameterlessm, is unchanged: it already reads well inside lambdas, placeholders and chains. -
Settled on the user’s delegation 2026-11-13 (built on branch
fmt-two-space):avin fmtkeeps a function’s clauses together. No blank line goes between a function’s signature and its first clause or between two of its clauses, at the top level, in a class, an object, a trait or a block alike, and blank lines the source wrote there are dropped, around any comments between the clauses too (the comments stay). A clause is recognised as the parser recognises one: the name of the signature or clause before it at its level, an argument list, then=, a guard or an indented block of guards; the signature is a line naming the function with typed parameters, no=and no indented body. The function counts as one declaration, so the blank line between it and a different declaration before or after it stays as before, and a blank line inside a clause’s body is the body’s own and stays. In a literate file, blank lines beside prose are the document’s and are kept even between clauses. Why: a function written as clauses is one declaration and the preferred form for a function that matches on its parameters; a blank line before a multi-line clause, which the rule for top-level declarations put there, makes it read as several declarations. Alternatives weighed: keeping the blank lines the source wrote and only not adding any (a file would read differently by who wrote it, and the formatter is meant to settle exactly this); a blank line between clauses only around a multi-line one (it still splits one function in two); a blank line between every clause (it spreads a short definition over twice its lines). -
Settled on the user’s delegation 2026-11-15 (built on branch
http-stream): A streamed response is aResponsewhose body a function writes through aBodyWriter(Response.stream(status, contentType, write), with alengthoverload, andResponse.eventsfor server-sent events through anEventWriter). The head saysTransfer-Encoding: chunked, orContent-Lengthwhere the length is given, or to an HTTP/1.0 client neither, the body ending with the connection. Each write answersResult[unit, IoError],Erronce the client has gone or the server is stopping and for every later write; a write past a given length traps; a handler trapping once the head is sent has its connection closed with no500. Why: oneResponsetype keeps routers, middleware and error pages working on streamed answers unchanged, and aResultper write makes the end of a stream the program’s ordinary control flow. Alternatives weighed: a separateStreamedResponsetype besideResponse(every handler type and middleware doubled); a handler handed the connection (the server loses its framing and keep-alive); writes that trap when the client has gone (a client leaving is not a bug). Review with the user: whetherResponse.events‘s fifteen-second keep-alive default suits. -
Settled on the user’s delegation 2026-11-15 (built on branch
http-stream): Typed parameters through aFromParamtrait of static methods,paramAs[T],queryAs[T](with a default overload) andqueryOption[T]answeringResult[_, ParamError],MissingorInvalid;string,int,long,realandboolimplement it. Why: a staticparsemakes a program’s own type a parameter type by oneimpl, and aResultlets?answer the client400. Alternatives weighed: separatequeryInt/queryLongmethods (closed to a program’s own types); trapping on bad input (a client error is not a server bug). -
Settled on the user’s delegation 2026-11-15 (built on branch
http-stream): Handlers that fail answerResult[Response, ToResponse]:ToResponseis a trait withtoResponse(), implemented byResponseitself andParamError,fromResultturns such a function into aHandler, and eachRoute.get…patchhas an overload taking one. Why:?then ends a handler with any failure the program’s own error types can render, and a plainResponsehandler is untouched. Alternatives weighed: oneResult-only handler type (every simple handler would wrap inOk); anError-bounded error rendered as500(hides the status the program meant). Making the overloads work needed two compiler fixes: a lambda tried against several overloads is compiled only for the one chosen, and an argument checked before the overload was chosen is made@sendablewhere the chosen one’s parameter is (testsoverload_lambda_return,overload_sendable,overload_sendable_capture). -
Settled on the user’s delegation 2026-11-15 (built on branch
api-request-values): A middleware hands values on through the request, keyed by their exact type:ServerRequest.withValue[T: Sendable](value: T) -> ServerRequestandvalue[T: Sendable]() -> Option[T].withValueanswers a new request; a second value of one type replaces the first; the key is the typewithValuewas given, compared exactly as a type pattern compares a generic type’s arguments (each value is held in an invariant privateCarried[T]as anAny), so a value handed on as a trait is not read as its class nor the reverse, andintis notlong. Parameters a router binds keep the values. Why: the type is a key no two middlewares collide on by accident and that needs no cast to read, reified type patterns make it sound with no new language feature, and a request id or a span from a logging middleware fits the same API as a user from an auth one. The names followwithParamsandheader(name)beside it. Both takeSendablebecause a handler may move what it reads onto another thread (untilStopped), and a non-sendableTis refused atvaluetoo rather than silently answeringNone. Alternatives weighed: a key object (RequestKey[T]) for two values of one type — not built, since a program wraps each in its owndatatype, which also names what the value is, and the library has no key-object idiom elsewhere; subtype matching on read (value[Role]()finding anAdmin) — refused, since which of two values answers would depend on their order; route parameters or headers as the carrier — strings only, and spoofable from the client; the nameswith/get—withalready means running a body on aMutex, andwithXis the request’s and the response’s existing form. Review with the user: whether a key-object form is wanted after all. -
Settled on the user’s delegation 2026-11-15 (built on branch
http-stream): Route groups and middleware are plain functions:type Handler, a middleware(Handler) -> Handler,Route.wrap,Route.underandRoute.group(prefix, routes, middleware)answering aVector[Route], nesting with the inner middleware inside the outer. A prefix must begin with/and not end with one, else it traps. Why: groups flatten into the router’s one ordered list, so matching,405andHEADstay as they were. Alternatives weighed: a nested router type (two matching rules); a prefix tolerating a trailing/(two spellings of one path, and//after joining). -
Settled on the user’s delegation 2026-11-15 (built on branch
http-stream): Error pages are anErrorPage = @sendable (int) -> Response, given toRouter(its404and405) andhttp.serve(every status it answers itself), defaulting toplainError, the reason phrase as text; the status sent is always the one given, and a405keeps itsAllow. Why: one function covers JSON or HTML pages without a table of statuses. Alternatives weighed: aMap[int, Response](every status listed by hand, and none computed); letting the page change the status (a404page answering200misleads clients). -
Settled on the user’s delegation 2026-11-15 (built on branch
http-stream):isStopping()anduntilStopped(wait)on aServerRequest,BodyWriterandEventWriter,untilStoppedrunningwaiton its own thread throughTcpServer.idle, so stopping cancels it and the handler getsNone. Why: a long poll or an event stream otherwise holdsjoin()until its client goes. Alternatives weighed: a cancellation token passed to every handler (every handler signature changes); leaving shutdown to the write timeout (a quiet stream would hold it forwriteTimeout). -
Settled on the user’s delegation 2026-11-15 (built on branch
api-websocket): An upgrade is aResponsetoo:Response.upgrade(protocol, take)is a101carrying anUpgrade, and the server, seeing one, writes the head withUpgrade: protocolandConnection: Upgradeand handstakeanUpgraded(the stream, the bytes it had read ahead past the request, the write limit, and the server’sisStopping/untilStopped), reading no more requests and closing the connection oncetakereturns; a trap intakecloses it with no500. Why: routes, groups and middleware apply to a WebSocket route unchanged, as they do to a streamed one, and the bytes read ahead are not lost when a client sends its first frame with the handshake. Alternatives weighed: a separate upgrade handler type onRoute(middleware written twice); handing the rawByteStreamalone (a frame read ahead with the request would vanish). -
Settled on the user’s delegation 2026-11-15 (built on branch
api-websocket): WebSockets inavin.net.http:webSocket(request, session, protocols, maxMessageBytes = 1 MiB, closeTimeout = 5 s) -> Responsechecks the handshake and answers101,405(notGET),426withUpgrade: websocket(no upgrade to a WebSocket asked),426withSec-WebSocket-Version: 13(another version) or400(HTTP/1.0, noConnection: Upgrade, a key not sixteen bytes of base64); the subprotocol chosen is the server’s first that the client offers.WebSocket.connect(url, headers, protocols, tls, timeout, maxMessageBytes)is the client,wsandwss. Both ends share oneWebSocket:send(text),send(bytes),ping,receive(),receive(limit),close(code, reason),isOpen,isStopping,untilStopped, answeringResult[_, WebSocketError](Closed(code, reason),Broken, and forconnectRefused,BadHandshake,Unreachable). Why: one module with the HTTP server it upgrades from, and errors the program’s control flow handles, as aBodyWriter‘s are. Alternatives weighed: anavin.net.websocketmodule (it needs the server’s private connection loop); a callback per message (onText,onClose; the session’s own loop reads more plainly and keeps its state in locals). -
Settled on the user’s delegation 2026-11-15 (built on branch
api-websocket): What a WebSocket does by itself: a ping is answered with a pong as it arrives and a pong is passed over; a fragmented message is put back together, control frames between its fragments answered; the size limit is checked against a frame’s declared length before its payload is read, so an oversized message is refused without being buffered (1009); text is checked to be UTF-8 once the message is whole (1007), and so is a close reason; a frame breaking the protocol (1002) — a client’s frame not masked or a server’s masked, a reserved bit, an unknown opcode, a fragmented or long control frame, a continuation with nothing to continue or a new message inside one, a close of one byte or with a code no endpoint may send, a 64-bit length with its top bit set — fails the connection: the close frame is sent and the connection closed at once. A close from the other end is answered with its code (none for none, heard as1005) and the connection closed; this end’sclosewaitscloseTimeoutfor the answer. A session returning with its WebSocket open closes it with1000; a server stopping closes it with1001at its next receive (the wait being throughidle) or send; a peer going without a close isClosed(1006, …). A frame’s length need not be in its fewest bytes, though this end writes it so; every message is sent as one frame; a client masks each frame with four bytes fromSecureRandom. Why: these are RFC 6455’s rules where it gives them, and where it leaves a choice (validating UTF-8 at the end rather than as fragments arrive, accepting a longer-than-needed length) the simpler one that still refuses what it must. Alternatives weighed: surfacing pings and pongs as messages (every session would answer them by hand); validating UTF-8 per fragment (fails a bad message sooner, at more code). Review with the user: aWebSocketbelongs to one thread, as its stream does (a TLS stream checks its owner), so a session that must send what another thread produces while also receiving polls withreceive(limit); aselect-like receive over a channel, or a sendable sending half, would be the next step if a program needs one. -
Settled on the user’s delegation 2026-11-15 (built on branch
lazy-local): A locallazy val, in a block, is the value of a cell made where it is declared, the core library’s privateLazyCell[T], holding the value, its state word and the closure computing it, so a read is that cell’s lazy field read: once on the first read, under the same protocol as a field’s between threads, with the same trap for a read made while it is being computed. The choices the request left open:- Closures share it. A closure capturing the name captures the cell, so a first read inside the closure computes it for the enclosing scope too, and the reverse; it outlives its block. A declaration in a loop body makes a new cell on every pass. Alternatives: copying the value into the closure at capture (would force it where the closure is made, defeating the point); one cell per declaration site (wrong for loops and recursion).
- The initializer sees the locals as they are at the first read, a captured
varincluded, since it is a lambda run then; fields see their object at the first read in the same way. Alternative: snapshotting the locals at the declaration (would need a copy of every capturedvar, and differs from what a lambda written in the same place does). - Across threads, sendable where its type is and its initializer would be. A
@sendableclosure (a thread’s body, a future’s) may capture a locallazy valonly where the value’s type is sendable and every local and parameter the initializer captures passes the rules that closure is held to, avarrefused, through each lazy value the initializer reads in turn; what the initializer reaches is held to the module-level state rule too. Why: the initializer may run on whichever thread reads first, so it is code the closure carries; a field’s initializer captures only its object, which the object’s own sendability covers. Alternatives: refusing every capture of a lazy local by a@sendableclosure (simpler, but refuses the plain case of a sendable value computed from sendablevals); checking the value’s type alone (unsound: an initializer capturing aBufferor avarwould run on another thread). - A self-read follows the other lazy values: today it traps at run time,
avin: trap: `x` is read while it is being initialized, as a field’s and a module-level value’s do, and a lazy list may refer to itself through its cells. The sound-initialization design (### lazy valin declarations) makes a read the initializer’s own code reaches a compile error; a local is held to it in the same way when that is built, and its run testslazy_local_self_direct(a direct read, which becomes a reject test) andlazy_local_self(a read through a closure the initializer calls, which stays a trap) say which side each falls on. A trap in the initializer stops the program as any trap does. - The type must be known where it is declared: an initializer whose type is not settled there
(one reading only its own value) is refused with “cannot infer the type of
x“, as a field’s is, rather than settled by later uses as a plainval‘s may be. An initializer that never finishes gives the typeNothing. A mismatch with a declared type is reported as “the initializer ofxyields …”. - One name per declaration:
lazy val (a, b) = …andlazy val a, b = …are refused (“take the value apart where it is read”), as is alazy valwithout an initializer; an assignment, a compound assignment and a step are refused as for a module-levellazy val. - Cost: a declaration allocates the cell and the initializer’s closure, both kept until the cell is unreachable. Alternative weighed: storing the value, state and closure in boxed locals without an object (saves one allocation but needs a layout of its own in the lowering and a separate sendability rule); clearing the closure after the first read (frees its captures early, but fields keep theirs, and a race-free clear needs another store on the hot path). Review with the user: the cross-thread rule (the more permissive of the two sound choices).
-
Settled on the user’s delegation 2026-11-15 (built on branch
sync-kit): AWaitGroupcounts work and has nospawn.add,done,wait, a timedwaitForandpending; a count below zero traps. Why: a scope already starts threads and waits for them structurally, so a spawning wait group would be a second way to do whatscopedoes; what a wait group adds is counting work finished by threads started elsewhere (an executor, an actor, another scope) or by no thread at all. Alternatives weighed:wg.spawn(body)starting and counting a thread (duplicatesScope.spawn, and an unscoped spawn escapes cancellation); answering a negative count by clamping at zero (hides a doubledone). -
Settled on the user’s delegation 2026-11-15 (built on branch
sync-kit): ASemaphorehas a capacity, and a release beyond it traps.Semaphore(permits, capacity = permits); negative permits, a capacity below one or more permits than the capacity trap too. Permits belong to no thread, and waiters are not queued (one arriving as a permit comes back may take it first). Why: an over-release is the same bug as a wait group’s doubledone, a permit given back that nobody took, and a trap finds it where it happens; the separate capacity keeps the signalling use (Semaphore(0, capacity = 1)) that an “at most the initial permits” rule would forbid. Alternatives weighed: an unbounded count (a silent over-release grows the limit for good); permits owned by the thread that took them (rules out a permit taken by one thread and given back by another, which hand-offs need); a FIFO queue of waiters (a cancelled waiter would have to take its place back, for a fairness the condition’s oldest-first wake mostly gives already). Review with the user: trap or ignore an over-release. -
Settled on the user’s delegation 2026-11-15 (built on branch
sync-kit):withPermitand aRwLock‘s read give back what they hold when a cancellation stops their body; aRwLock‘s write runs to its end; a trap in any of them stops the program. The share is taken under the library’s lock and held in a region in doubt from that moment until it is given back (the runtime’s newlock_release_holdingandcancel_guarded_held), so no cancellation can come between taking it and the body. A read body or a permit’s body runs at a cancellation point of its own inside that region, so a cancelled scope stops a long download insidewithPermitat once and the permit goes back, while a trap there, even in an actor, stops the program as one under a lock does, since recovering the actor’s turn would leave the share held for ever. A write body is also uncancellable, as aMutex‘s body is, since stopping it could leave the value half changed. Why: a semaphore guards no value, and a reader changes nothing, so nothing is left in doubt by stopping them; a writer does change the value. Alternatives weighed: every body uncancellable, as a mutex’s (a scope’s cancellation would wait for every permit holder’s whole body); every body cancellable (a write could leave the value torn); a trap in an actor’s body failing only the actor (needs a give-back chain run by the actor’s recovery, which the runtime does not have). -
Settled on the user’s delegation 2026-11-15 (built on branch
sync-kit): ARwLocklets writers in first, and lets in the readers a write kept waiting before the next writer. A reader that arrives while a writer waits waits behind it; when a write ends, every reader then waiting is admitted ahead of the writers waiting. Why: writers do not starve under overlapping readers, and readers do not starve under back-to-back writers, with no tuning. Alternatives weighed: pure writer preference (readers starve while writers keep coming); reader preference (writers starve); a strict FIFO of both (serialises readers that could share). Review with the user: a read body is trusted only to read; nothing stops it changing a mutable value other readers share, which races with them (a race is not undefined behaviour in Avin, but the type system does not rule it out here as it does elsewhere). A read-only view of a value would close it and is a language feature, not a library one. -
Settled on the user’s delegation 2026-11-15 (built on branch
sync-kit): ABarrier‘s action runs under its lock, and a party cancelled while waiting withdraws. The last arrival runs the action holding the barrier’s lock, so the action is uncancellable and one that waits on its own barrier traps as a lock taken twice does;waitanswers whether the caller arrived last. A cancelled waiter takes its arrival back (it is not counted for the round), through the runtime’s settling condition wait, which answers a cancellation with the lock held again rather than stopping at once. Why: a scope cancelled mid-round leaves the barrier as if the stopped parties had never come, ready for new ones. Alternatives weighed: a cancelled party staying counted (the round could trip with a party missing); “breaking” the barrier for every party (a state eachwaitwould have to answer); running the action outside the lock (waiting on its own barrier would then deadlock instead of trapping). -
Settled by the user 2026-11-14 (built on branch
contextual-keywords, from the user’s decision of 2026-11-14 thatdatakeeps its spelling and becomes contextual): the words that begin a top-level declaration are keywords only there, before the name they declare, and ordinary names everywhere else:data,class,object,trait,impl,importandmodulejointype,opaque,export,derive,actorandmachine, andopenandabstractare keywords only beforeclass. Soval data = readFile(p), a fieldclass, a methodobject(), a parameterimport, a named argumentmodule = 2, a type parameter, a variant, a module nameddataandr.typeare all legal, anddata(x: int)at the top level declares a function calleddata. The reserved words stay:as,is,match,then,else,elif,do,yieldandderives, because each follows a complete operand on its line (x as T,if c then a,Base(x) derives Eq), where a name is an infix call;if,while,for,loop,defer,return,break,continue,val,varanddef, because each begins a statement or a declaration inside a block, where a line may equally be an expression starting with a name (loopand an indented block would read as a call ofloopwith a trailing block;return (x)as a call);private,staticandoverride, because they begin a member of a class body, where a line may be a statement, andprivate + (o: T)would be both a method named by a symbol and an expression on a value;true,false,selfandsuper, which are values.endkeeps its rule (a keyword only before a name), andnotandwiththeirs. Why: the test is whether the keyword’s every position can be told from a name’s by the next token alone. A top-level line holds only declarations, never a statement, so a declaration word followed by a name can mean nothing else, and none of these words begins anything inside a block or a class body. Alternatives weighed: renamingdata(the user kept the spelling); making every word contextual by look-ahead over whole lines (loop,returnand the modifiers would each need a rule of their own that a reader cannot see at a glance); keepingclassandobjectreserved as the most declaration-like (they are common field names, and nothing about them is less decidable thandata). The user settled 2026-11-14 thatprivate,staticandoverridestay reserved: a modifier used as a variable name would read strangely. -
Settled on the user’s delegation 2026-11-14 (built on branch
hkt-7): a trait for types whose members never writeSelfbounds constructors too (generics). A trait with parameters, no static member, no member namingSelfbeyond the receiver, and requiring only such traits (Foldable[A], anyCountable[A]of a program’s own) is a trait for types everywhere it is one, and also a bound of a constructor parameter of its arity:impl Foldable for Optionmakes eachOption[T]aFoldable[T], soOptionis a constructor for[F[_]: Foldable], and a constructor trait may require it at its own parameters (trait Traverse[A]: Functor[A], Foldable[A]). A type conforms as a constructor only where a conformance states the trait’s parameters as its own parameters, soimpl Foldable[int] for Intsmakes no constructor; a type whose parameter is bounded is one only for a hole promising that bound (TreeSetforF[_: Ord]), as for a constructor trait; a trait namingSelfotherwise or declaring a static member bounds types only, and one writingSelf[X]stays a constructor trait, never a type. Why:Foldable‘s method mentions noSelf, so what it promises of anF[X]is exactly what the type conformance promises of that type; one trait serves both uses, generic code over constructors reads the conformances the collections already have, and nothing new is needed at run time (each instance’s call is the ordinary call on its type). Alternatives weighed: a constructor trait requiring a trait for types at its holes (a constraint on every applicationSelf[A], a second notion with its own rules, where the dual reading needs none); givingFoldablea method that writesSelf(an artificial member, and it would stopFoldable[int]being a type). This supersedes the Proposed “a constructor trait requires only constructor traits” (branchhkt-3) for traits that bound constructors. -
Settled on the user’s delegation 2026-11-14 (built on branch
hkt-7): everyIterable[A]is aFoldable[A].IterablerequiresFoldableand givesfoldLeftas its default, moved from the impl adding methods to everyIterable;Listgives its own walk in its impl ofSeqandVectoroverrides it, so every collection of one parameter is a constructor for[F[_]: Foldable]with no impl of its own, andOption,ResultandEithergainfoldLeftin their impls ofTraverse. A class of a program’s own conforming toIterablethat declares its ownfoldLeftnow marks itoverride. Why: the fold is what every collection already has, and the nominal rule needs a conformance; one inIterablegives it to all of them at once. Alternatives weighed:impl Foldable foreach collection (an impl per type, each restatingfoldLeft, since a method an impl adds to a trait does not implement another trait’s); leaving the collections out ofFoldable(generic folds would not take aVector). -
Settled on the user’s delegation 2026-11-14 (built on branch
hkt-7):SeqandSetleave the table of the standard constructor traits; the impls are for concrete types only (generics):List,Vector,ArraySeq,Queue,LazyList,Array,Buffer,Deque,Option,Result,Either, and the sets and sorted collections asFoldableonly, since theirmapanswers aSetand needsEq & HashorOrdof its result. Generic code over sequences takes anF[_]: Monad(or the trait it needs). No impl is for a trait type. Why: an impl is for a type’s own constructor, and a trait’smapanswers the trait’s type for every implementing class, soSeqcould meetFunctoronly through an impl for a trait, which the language does not have. Alternatives weighed: impls for trait types, a future language feature, added only if a library need appears. -
Settled on the user’s delegation 2026-11-14 (built on branch
hkt-7):traverseandsequencethroughApplicative.map2applyfto every element and answer the first failure. The spec’s “stops at the first failure” means the result, not evaluation: a sequence’straversefolds throughmap2, which runsfon each element in order, and the firstNone,ErrorLeftdecides what is answered. Why:traverseis written once for every applicative, andmap2is all an applicative gives; stopping early would need a short-circuiting fold the trait does not have. Alternatives weighed: a stoppingtraverseper constructor of the result (Option‘s,Result‘s), which generic code at a program’s own applicative would not have. -
Settled on the user’s delegation 2026-11-14 (built on branch
hkt-7): a constructor trait’s parameter bounds ask nothing of the conforming type’s parameters:impl SendableMonad for Future, whoseThas no bound, conforms, since the trait applies the constructor only to types meetingSendable; a type whose parameter is bounded by more than the trait’s parameter promises is still refused, and a trait requiring the trait bounds its own parameter as it does. A conformance had heldTtoSendableas an ordinary trait argument, against the spec’s “bounded by no more thanSendable“. Alternatives: none that keepFutureaSendableMonadwith its parameter unbounded. -
Settled on the user’s delegation 2026-11-14 (built on branch
hkt-8): a value bounded by two traits that reach one method, one of them overriding it, has the override alone: withF[_]: Monad & Filter,fa.mapisMonad‘s default, not also theFunctormethodFilterrequires; withT: Loud & QuietoverBase,describeisLoud‘s override. The calls had been reported ambiguous, so the spec’sF[_]: Monad & Filtertook no comprehension. Why: a type conforming to both has the override as its one method, so the bound has it too, as a type inheriting both already did (unreplaced). Alternatives: none; the ambiguity was a bug. -
Settled on the user’s delegation 2026-11-14 (built on branch
hkt-8): the viewswithFiltermakes conform toIterable, each by aniterator()that tests the source’s elements as they are reached; their ownmap,flatMap,withFilterandforeachare kept, so a comprehension’s result is the collection’s as before. Why: the spec says the calls after a guard are on anIterable; a view may now be held as one, looped over and folded. Alternatives: leaving the views outside the hierarchy (a guard’s result could not be passed where anIterableis wanted). -
Settled on the user’s delegation 2026-11-14 (built on branch
hkt-8): a refused comprehension source names the fix only where the module can make it:declare impl Monad for Boxfor a type of one parameter declared in the module being checked, “declare an impl ofMonadforPairat the parameter it holds its elements in” for one of more, “a type of no parameters is a source only as anIterable“ for one of none, “addMonadto the bounds ofF“ in generic code, and nothing for another module’s type (Result‘s missingFilter), whose impl the module rule puts out of reach. The source is named where it is a name (`box` is a `Box[int]`), “this source” otherwise; a guard’s refusal is reported at the guard. A source is checked for its roles before any call on it, and a refused one checks nothing after it. Alternatives: always suggesting an impl (wrong advice for a library type). -
Settled on the user’s delegation 2026-11-15 (built on branch
api-pool): a resource pool isavin.threads.Pool[T, E], lending through a body (pools).use(f)andlease(f)lend a resource for the call offand always take it back, answeringResult[R, PoolError[E]]; there is noacquire/releasepair. Why: the scope of the body is what makes “always returned” true by construction, on a return, a cancellation inside it, and a trap (which stops the program); a resource handed out byacquirecomes back only if every path remembers to give it back. It sits inavin.threadsbeside the semaphore it resembles, built on the same lock and cancellation machinery; the executor’s private worker pool, which was also calledPool, is renamedWorkerPool. Alternatives weighed: anacquire()answering a lease torelease()by hand (an actor holding a connection across messages would want it; it can be added beside the body form later); a module of its own (avin.pool), which would need the threads module’s private machinery made public. Review with the user: whether an explicit acquire/release form is wanted for resources held across an actor’s messages. -
Settled on the user’s delegation 2026-11-15 (built on branch
api-pool): a pool’s resources are isolated rather than sendable. APoolis sendable whateverTis, as aMutexis:create,validateanddestroyare@sendable, so a resource is made from sendable values alone, anduse‘s andlease‘s bodies are@isolatingand give back a sendableR, so the resource never leaves the call it is lent to. Why: the resources worth pooling are mutable (a connection’s buffers and state), and a program’s mutable class cannot promiseSendable(the@trusted_sendablemark is the standard library’s), so a pool that askedT: Sendablecould not hold the database client it exists for. The cost: a body may not capture a mutable value from around it, and two mutable resources cannot be used in one nested body (db.use(c -> cache.use(r -> … c …))is refused, since the inner body capturesc). Alternatives weighed:T: Sendable(sound, and too narrow, as above); unrestricted bodies (a resource kept past its call would be used by two threads at once). Review with the user: the nested-body restriction, which a borrow form the language does not have would lift. -
Settled on the user’s delegation 2026-11-15 (built on branch
api-pool): a pool’s waiters are served first come, first served, by direct hand-off. A resource given back goes straight to the call that has waited longest, and so does the place a destroyed resource or a failed make gives up; a new call queues behind any waiter even when it comes just as a resource is given back, so no call is overtaken. Idle resources are lent most recently used first, so the oldest expire underidleTimeout. Why: fairness the brief asks for, and anAcquireTimedOutunder load then means the pool is too small rather than unlucky. Alternatives weighed: waking any waiter and letting it race (the semaphore’s way; cheaper, and unfair); oldest idle first (keeps every connection warm, and none ever expires on a quiet server). -
Settled on the user’s delegation 2026-11-15 (built on branch
api-pool): every function a pool runs for a call runs where a trap cannot be contained. A trap insidef,create,validateordestroystops the program even in an actor, as one insidewithPermitdoes. Why: an actor that survived the trap would leave the pool counting a resource or a place that is never given back, shrinking it for good.fandcreatestay cancellable;destroyruns to its end. Alternatives weighed: containing the trap and leaking the place (a pool that slowly loses capacity in a long-running server). Review with the user: a server whose handlers are actors may prefer the handler’s failure to the program’s. -
Settled on the user’s delegation 2026-11-15 (built on branch
api-pool): idle resources expire when the pool is next used, not on a timer of their own. A call looking for a resource, andevictIdle(), destroy those idle longer thanidleTimeout, keepingminIdle;minIdlealso sets whatwarm()makes, and is not kept topped up as resources are destroyed. Why: a pool then starts no thread and holds no timer, and a program that wants eviction on a quiet pool callsevictIdlefrom aTicker. Alternatives weighed: a reaper thread per pool (a thread that outlives every call and must be stopped byclose); refilling tominIdleafter each eviction (acreatefailing in the background has nobody to report to). -
Settled on the user’s delegation 2026-11-15 (built on branch
api-pool): a pool’s failure isPoolError[E]:AcquireTimedOut,PoolClosed,CreateFailed(error: E). It is anErrorwhereEis,CreateFailedhavingerroras itscause, and shows the same sentence whereverEhas aDisplay. The case names carryAcquire/Poolso that they do not clash withavin.io‘sTimedOutin a program importing both. Timeouts areOption[Duration],Nonefor waiting for ever. Alternatives weighed: astringerror (loses the database’s own error);Option[T]fromuse(a caller could not tell a timeout from a closed pool). -
Settled on the user’s delegation 2026-11-15 (built on branch
pool-production, for the PostgreSQL driver’s pool): aPooltakesmaxWaiting: Option[int], and a call that would wait while that many already wait fails at once with a new case,QueueFull. A server on lightweight threads under overload otherwise queues every request behind the pool until each one’s timeout, holding a thread and a socket for each; failing at once lets it answer 503. The bound is checked under the pool’s lock where the call would join the queue, so it is exact under any number of threads; a call that finds a resource idle or a place to make one is never refused, and a call already queued that has to look again (its resource failedvalidate) is not refused either. It lives inPoolrather than in a wrapper because only the lock knows the queue’s length: a count kept outside overshoots by every caller racing past the check. Alternatives weighed: a separate admissionSemaphorein front of the pool (bounds callers inside, not callers waiting, so it refuses while resources are idle); reusingAcquireTimedOut(a server cannot tell overload from a slow database). Review with the user:QueueFullis a new case of a publicdata, so an exhaustivematchonPoolErrorelsewhere needs an arm. -
Settled on the user’s delegation 2026-11-15 (branch
pool-production):maxLifetimeandjitterretire old resources, andjitterlengthens limits, never shortens them. A resource older thanmaxLifetimeis destroyed rather than lent (looked at in the lending, beforevalidate) or kept (looked at as it comes back), andevictIdledestroys idle ones however few that leaves,minIdlebeingwarm‘s to make up, since an aged connection is replaced, not kept. Each resource draws its part ofjitter, from 0 up tojitter, once when it is made, and both its lifetime and its idle limit are lengthened by it; the draw comes from a SplitMix64 generator of the pool’s own under its lock, sinceavin.randombuilds onavin.threads. Adding rather than subtracting follows the PostgreSQL driver pgx (MaxConnLifetimeJitter), keeps every limit a true minimum, and needs no clamp whenjitterexceeds a limit. Alternatives weighed: subtracting the jitter (a limit becomes a ceiling, which suits a server-side cutoff, but a jitter longer than the limit would need clamping); a jitter as a fraction of each limit; jitter on the lifetime only. Review with the user: subtracting is the other common choice. -
Settled on the user’s delegation 2026-11-15 (branch
pool-production):counters()answers aPoolCountersof running totals besidestats(), rather than wideningPoolStats.acquires,waited,waitTime,timeouts,rejected,createdanddestroyedare what a server exports as metrics (pgx’sStat, a pool’s usual gauges);PoolStatsstays the deterministic snapshot of what is held now, which tests and programs print, whilewaitTimevaries run to run.waitTimeruns from the call to the lending, so it includes making or checking a resource, as pgx’sAcquireDurationdoes. Alternatives weighed: one widerPoolStats(its printed form would stop being stable); counting in each user’s wrapper (waitedandtimeoutsare only known under the lock). -
Settled on the user’s delegation 2026-11-15 (built on branch
select-readable): a thread waits for a connection’s bytes OR a channel’s value with aselectarm,stream.readable() -> body, not with a second waiting mechanism. A connection belongs to one thread (its reference counts are not atomic, and OpenSSL is single-threaded per connection), so the thread that owns a WebSocket must do all of its reads and writes, and so must wait for “bytes arrived or another thread queued a frame”. The arm fits the others’ shape, an operation on its operand (ch.receive(),ch.send(x)), so it composes with channel arms,afterandelse, and the select’s one-park, wake-once token covers it: where the stream is not readable when tried, its descriptor is registered with the runtime’s poller for one report under the select’s own waiter, and every ending withdraws it under the poller’s lock, as channel links are withdrawn. The arm binds nothing and reads nothing (its body reads), since a read’s size and form (read(max),readLine) are the body’s choice. Ready means a read would answer without waiting: buffered read-ahead, TLS plaintext already decrypted or a whole record arrived (TLS’sreadable()hands the engine the ciphertext already on the socket, so part of a record does not count, and keeps any failure it meets for the next read), the end, a reset or a closed connection. Its operand is the traitavin.threads.Readiness(readable() -> bool,readinessDescriptor() -> int), whichByteStreamextends, soavin.threadsneeds nothing ofavin.net, and a source of one’s own, with-1for no descriptor, can be named too. The thread dump counts the arms as sockets (“in a select on 1 channel and 1 socket”). Alternatives weighed: an interruptible socket wait rung by a waker (smaller, but a second way to wait beside select, composing with neitherafternor several channels); an arm that reads and binds the bytes,conn.read(n) as bytes(fixes the read’s form in the arm, and areadLinecould not use it); waking on socket readiness alone for TLS (a partial record would wake a select whose read then blocks). Review with the user: the spellingreadable()and the nameReadiness; whether the descriptor should stay a public method. -
Settled on the user’s delegation 2026-11-15 (built on branch
ws-sender): a WebSocket’s other threads send throughws.sender(), a sendableWebSocketSenderthat queues whole messages in a bounded outbox the owning thread writes while it receives. The owner’sreceivewaits in oneselecton the stream’sreadable(), the outbox, a sender’s close request, the server’sstopped()channel and the limit, so every frame (senders’, its own, pongs, the close handshake) is written by the thread the connection belongs to, a message at a time, never interleaved. Alternatives weighed: a mutex around the socket shared by every writer (impossible: a TLS stream and a socket’s handles belong to one thread); a writer thread per WebSocket (a second owner of the connection, the same impossibility); an unbounded outbox (a slow client would hold every message ever sent to it). -
Settled on the user’s delegation 2026-11-15 (built on branch
ws-sender): the outbox is bounded in messages,outboxSize = 64onwebSocketandWebSocket.connect, not in bytes; a send to a full one waits up to the WebSocket’s write timeout and answersErr(Broken(IoError(TimedOut, _, _))), the WebSocket left open. A message bound is one bounded channel, and the owner’s write to a client that does not read fails at the same write timeout, closing it, so a slow client holds at most 64 messages and its senders at most one write timeout each. Zero is a hand-over: each send waits for the owner to take it. Alternatives weighed: a byte bound (needs a second counter beside the channel, and one huge message would still have to be admitted); failing at once when full (a burst would lose messages a healthy client reads a moment later); closing the WebSocket when a send times out (the owner’s write timeout already does, for a client that really stopped). Review with the user: whether a byte bound is wanted beside the message bound, and the default 64. -
Settled on the user’s delegation 2026-11-15 (built on branch
ws-sender):Okfrom a sender means queued while open; the close is a request, and the senders are refused from the start of any close. A sender’sclose(code, reason)sets the shared state at once (every sender call after answersErr(Closed(code, reason))) and the owner carries it out while it receives, after writing what was queued before it. The owner’s close refuses senders from the start of its handshake, and its end (close, peer close, failure, server stopping, cancellation) drops what is queued and wakes every sender waiting for room. A message queued in the instant the WebSocket ends may answerOkand be dropped, as a write accepted by a socket that then breaks is. Alternatives weighed: anOkonly once written (every send would wait for the owner’s next receive); closing from the sender’s thread (it does not own the connection). -
Settled on the user’s delegation 2026-11-15 (built on branch
ws-sender): a session that only answers what arrives loops inws.serve(onMessage) -> WebSocketError, which receives until the WebSocket closes and answers why, besidereceive(), which a session may loop on itself; it is while the owner receives that its senders’ messages are written, so a session must be in one or the other. Alternatives weighed: a background writer started bysender()(a second owner); no helper, documenting thereceive()loop (the chat server’s loop is written once in every app). -
Settled on the user’s delegation 2026-11-15 (built on branch
ws-sender): data messages over 65536 bytes are sent in fragments of 65536, written back to back, by the owner’ssendand by senders alike, so a peer limiting frame sizes still takes large messages; a pong waits for the end of the message being written. A thread cancelled while it receives closes the connection with no close frame (a frame may have been half written) and ends the WebSocket with1006.TcpServer.stopped()is a channel closed bystop, which the owner’s select watches in place of running each wait on a thread of its own throughidle. Review with the user: the fragment size, and whetherstopped()should be a receive-only view rather than aChannel[unit]. -
Settled on the user’s delegation 2026-11-15 (built on branch
stdio-blocking): standard input and output wait safe for the collector. Every read of standard input and every write to standard output or standard error, a flush and a trap’s report included, marks its thread safe for the collector while it waits, the string being written kept in a frame of the runtime’s own. A lightweight thread reading standard input from a stream with no position (a pipe, a socket, a terminal where the platform answers so) parks on the poller first; one reading a file or a device reads at once, since the poller does not report a file at its end as ready. Writes do not park: the output goes through the C library’s buffer, shared with any C code the program calls, so a thread held up writing keeps its worker, counted as blocked, and the monitor runs another in its place. The wait for standard input is not a cancellation point, as it was not before: a cancelled thread goes on waiting for its line. Why: the smallest fix that keeps the behaviour the program sees; making it one would add a failure path toreadLine, which answers no error. Alternatives: parking writes too (needs non-blocking standard output, which a pipe shared with the parent process cannot be given safely); a cancellable input wait that unwinds the thread as a sleep does. Review with the user: whether waiting for standard input should be a cancellation point. -
Settled on the user’s delegation 2026-11-15 (built on branch
net-split-writable): a connection splits into a reader and a writer for two threads at once.ByteStream.split() -> (StreamReader, StreamWriter), forTcpStream,UnixStreamandTlsStream; both halves are sendable traits, each half its own thread’s, so a driver pipelines a batch of any size without stopping at windows for the send/receive buffer deadlock (found by the pg driver’s batch item). Closing the writer half-closes (shutdown write; TLS sends its close notice first); closing the reader only stops reading; the connection closes once both halves are closed or unreachable. The split connection is used up (every operation answers an error naming the split; closing it does nothing); splitting it again, or splitting a closed connection, traps. Noreunite: a protocol that wants one owner again keeps both halves on one thread, and a reunite would have to check that the two halves are of one connection and that neither has pending state. A TCP or Unix writer’scloseanswersOkwhere the peer has gone, as a connection’s does; a TLS writer’s answers whether the close notice went out, asTlsStream.closedoes. Each half holds its own handle on the socket (avin.rt.socket_share), so each is owner-checked on its own. The runtime’s poller keeps, per descriptor, the waiter of each direction and registers the union of the two (runtime/avin/rt/sockets.sysl), so a reader parked for bytes and a writer parked for room wait on one descriptor at once; before this a second registration replaced the first under epoll. A TLS stream’s halves share one session in a@keeps_ownersobject: the engine and the TCP writer are reached only holding a lock of their own, each handle taken from transit by the code holding the lock and handed back before it goes (a cancellation included, bydefer), and nothing is held while waiting for the connection, so the reader decrypts while the writer waits for room. A reader that has ciphertext of its own to send sends it only where nobody else is sending (tryAcquire), and otherwise leaves it owed to the writer. Alternatives weighed: concurrent reads and writes on one connection value, with no halves (no owner check could then tell a misuse from a use);duping the descriptor for the writer (Sysl’sSocketcannot adopt one, and the poller would still need two registrations under kqueue’s filters); a TLS writer that waits for the reader on every record (a renegotiation alone needs that, and the writer does wait for it then). Review with the user: whether a reunite is wanted, and that a writer told by TLS to wait for the peer (a renegotiation) waits for its reader to read. -
Settled on the user’s delegation 2026-11-15 (built on branch
net-split-writable):writable()is a select arm besidereadable(), with a partial writewriteSome(bytes) -> Result[int, IoError].threads.Writability(writable(),writabilityDescriptor()) besideReadiness; everyByteStreamand everyStreamWriteris one, andselectreadssink.writable()into aSelectWritablearm, watched on the poller for room.writeSomeis added because the arm needs it to be useful:writesends everything and so waits again after the arm said there was room. It waits for room for the first byte only where there is none, sends what fits, and answers at least one unless given nothing. Over TLS it hands TLS at most one record (16384 bytes of plaintext) and sends what of the record fits; the rest is kept and goes before anything else, andwritable()sends it as room comes and answerstrueonly once it has gone, sowriteSomeafterwritable()never waits; a read meanwhile leaves its own ciphertext queued behind that record rather than waiting for room. Alternatives weighed: nowriteSome, the arm forwrite(waits again on a large write, as above); a TLSwriteSomethat sends its whole record (waits for room for a record after the arm said there was some); awritable()that ignores the kept record (a select that finds the socket writable and the arm not, round after round, spinning). Review with the user: the TLS record bound ofwriteSome, and the nameswriteSomeandwritabilityDescriptor. -
Settled on the user’s delegation 2026-11-19 (branch
read-secret):io.readSecret(prompt),readSecretBytesandreadSecretOrLineread a line from the controlling terminal with echo off. fettle prompts for a sudo or ssh password, as does any tool asking for a passphrase, and nothing in the library read input with echo off. The calls open/dev/tty(so a piped standard input does not matter), write the prompt to it, turn offECHOandECHONLwhile keepingICANON, and restore the exacttermiosfound. Details settled: (1) no terminal isErr(IoError(NoTerminal, "read", "the terminal")), a newErrorKindcase, since a program tells it apart from a failed read;readSecretOrLineis the opt-in fallback, writing the prompt to standard error and reading a line from standard input, as a tool run by a script with its password piped in needs. (2) Signals:ISIGstays on, and for the length of the read the C side (runtime/avin/rt/__posix__/secret_tty.c) catches interrupt, hangup, terminate and quit: its handler restores the terminal, gives the signal its previous action back and sends it again, so the program dies or handles the signal with echo on; a program that survives sees the read fail asOther("interrupted"). A terminal stop (Ctrl-Z) is caught too: the handler restores the terminal, stops the program with the default action, and on continue hides the terminal again and the read writes its prompt again and goes on (assudoandgetpassdo); what was typed before the Ctrl-Z is discarded by the terminal. SIGTTIN and SIGTTOU are not caught: they stop a program before the terminal has been changed. (3) Concurrency: the read holdsinput_readers, the lock of every standard input reader, so a secret and areadLinenever read the terminal at once; a lightweight thread waiting for the line is not cancellable, as one waiting for standard input is, so a cancel takes effect once the line has been read and the terminal is back. (4) Bytes:readSecretBytesreturns anArray[byte]the caller can overwrite;readSecretis a string, which has no way to be cleared, and the runtime clears its own gathering buffers. (5) A trailing\nand a\rbefore it are dropped; the end of input with bytes typed ends the line, with none it isOther("end of input"). Alternatives weighed: turningISIGoff asgetpassdoes (Ctrl-C then arrives as a byte only once the line ends, so it would not interrupt a prompt); reading standard input when there is no terminal by default (a secret would then show on the screen, and a program that means to read one must ask by name); a cancellable wait (the existing standard input lock holds the thread’s cancellation off, and a read cut short would leave typed bytes half taken); a singlereadSecretwith a fallback flag. Tests drive real programs over a pseudo-terminal (tests/pty/pty_drive.c,secret_tests.sysl). Review with the user: the namereadSecret(againstreadPasswordorpromptSecret), and the no-terminal behaviour: an error by default withreadSecretOrLineas the explicit fallback, rather than falling back to standard input on its own. -
Settled on the user’s delegation 2026-11-19 (branch
stdio-bytes):io.stdin()is standard input as aReaderof bytes, andio.stdout()andio.stderr()are standard output and error asByteWriters, answering theSendableobjectsStandardInputBytes,StandardOutputBytesandStandardErrorBytes. Source: the avin-lang/lsp package could not serve LSP over stdio, whoseContent-Lengthcounts bytes, sinceavin.ioread standard input only as text decoded with U+FFFD and had no byte writer for standard output; the workaround would have bound Sysl’sFdReaderdirectly, as the tui package does. Details settled: (1) Mixing: byte reads take from the one bufferreadLine,lines(),readAllandSource.stdin()share (runtime/avin/rt/input.sysl), so a header read as a line and a body read as bytes go on from each other with no byte lost or read twice; a read answers what the buffer holds, else one read of the input. (2) Serialization: byte reads holdinput_readers, the lock of every standard input reader and ofreadSecret. (3) Parking: a lightweight thread waits on the poller, as a line read does. (4) End and failure: the end is an empty array, every time it is asked; a read that fails isErr(Other(<platform sentence>))for bytes, while the text readers keep seeing the end. (5) Output: a byte write is unbuffered and goes out whole before it returns, behind whatprintbuffered: it holds standard output’s stdio lock while flushing that buffer and writing to the descriptor, andprintlnwrites its whole line through the same stream, so a printed line is never split by a byte write (the println-atomic entry of 2026-11-15 still holds); a write to standard error flushes standard output first, aseprintdoes. (6) A reader that has gone: SIGPIPE is held off for the length of a byte write (on macOS by the descriptor’s own mark, the 2026-11-20 entry below; elsewhere blocked on the writing thread, the one the write raised taken back), so the write answersConnectionReset(EPIPE, the kind a connection’s write answers) and the program goes on;printkeeps its quiet death, which a filter in a pipeline wants. (7) Closed descriptors: a bug met on the way, a program started with standard input closed read the runtime’s own pipe, which had taken descriptor 0; the runtime now opens/dev/nullon each of 0, 1 and 2 that is missing before it opens anything. Alternatives weighed: an error for mixing text and byte reads (two buffers or a mode switch, and a header and body protocol could not be written at all); a bufferedstdout()withflush(a byte write could then be overtaken by, or split, aprintln, and an LSP message must leave whole); ignoring SIGPIPE for the whole program (everyprintto a closed pipe would then have to fail somewhere, where today it ends the program quietly); public objects alone with no functions (a module-level function reads asio.readLine()does). Tests:stdio_tests.sysl, drivingtests/stdio/stdio_bytes.avinthroughshandtests/pty/stdio_tty.avinover a pseudo-terminal, at -O0 and -O2. Review with the user: the namesstdin(),stdout(),stderr()and the object namesStandardInputBytes,StandardOutputBytes,StandardErrorBytes(beside the text writersStandardOutputandStandardError).- Settled on the user’s delegation 2026-11-20 (branch
stdio-sigpipe): on macOS a byte write to standard output or error marks the descriptor never to raise SIGPIPE (F_SETNOSIGPIPE) for the length of the write only, and puts back the mark it found. WHY: macOS raises the SIGPIPE of a write to a gone reader on the whole process, where any thread not blocking it takes it, so blocking it on the writing thread (item (6) above) failed whenever the program had another thread: four threads writing toprog | head -c 10, or one writer beside busy threads, ended with status 141 every time at -O0 and -O2 before the change. The mark belongs to the open pipe or socket, which the shell and the program’s children share, so it is held under the stdio locks of both standard streams and taken off before the write returns:print,eprintand a child writing to the same output keep their SIGPIPE, and nothing is left changed on the shell’s pipe after the program ends. On Linux the signal goes to the writing thread, so the thread mask is kept there unchanged. ALTERNATIVES: marking descriptors 1 and 2 once at startup (everyprintto a gone reader would then fail silently and a printing loop would never end, every child and every later process on the shell’s pipe would inherit the mark); ignoring SIGPIPE for the whole program (the sameprintproblem, and an ignored signal survivesexecinto every child). Tests:stdio_tests.sysl§ several writing threads, a writer beside busy threads, threads writing to standard error,printwithout a newline after a failed byte write, and a child (yes) started after one, at -O0 and -O2.
- Settled on the user’s delegation 2026-11-20 (branch
-
Linux as a target, and machines in packages (branch
linux-plan, 2026-11-19; the user, 2026-11-19: Avin is “for anyone who would enjoy using it”). The plan is Linux; the package surface is machines.- Settled on the user’s delegation 2026-11-19: Avin’s targets are
aarch64-macos,x86_64-linuxandaarch64-linux, glibc on Linux, named as Sysl’s target registry names them. WHY: they are Sysl’s release platforms, so the toolchain Avin drives at every build exists on each; servers and CI are overwhelmingly x86_64 Linux, and aarch64 Linux is what a Mac’s containers run natively. ALTERNATIVES: x86_64 Linux alone (leaves out Arm servers and makes every local Linux test an emulated one); musl (static executables, but Sysl’s registry and its library are glibc’s); Intel macOS and Windows (Sysl ships neither). - Settled on the user’s delegation 2026-11-19: Avin is built natively on each target, not
cross-compiled from the Mac. WHY: an installed Avin runs
sysl build-cand clang at every user’s build, so Linux needs Sysl and clang on Linux whatever the release does, and a native build is the configuration users run; cross-building would add a sysroot to manage for no user. Local Linux work runs in a colima VM (aarch64, native speed on Apple silicon) through marshal; CI runs GitHub’s x86_64 and arm64 Ubuntu runners. ALTERNATIVES: cross-compiling from the Mac with a glibc sysroot (Sysl cannot yet: the probe ofsysl build --target x86_64-linuxfails building its standard module,stdio.hnot found, and Sysl has no way to name a sysroot); both (cross kept foravin build --target, a later item once Sysl has sysroots). - Settled on the user’s delegation 2026-11-19: a Linux release ships a tarball per target
(
avin-<v>-linux-x86_64.tar.gz,avin-<v>-linux-arm64.tar.gz, the same prefix layout as the macOS one) and an install script that installs Avin and the Sysl it needs into a prefix and names the distribution’s packages for clang, lld, llvm-ar and pkg-config; the Homebrew formula gainson_linuxonce Sysl’s formula has it. No.deb. WHY: a tarball is what every other route is built from, and an install script reaches every distribution with no repository to host or sign. ALTERNATIVES: Linuxbrew only (needs Sysl’s formula on Linux first, and many servers have no brew); a.deband an apt repository (hosting and signing, one distribution family); a static single binary (Avin needs Sysl and clang beside it anyway). Review with the user: whether a.debis wanted later. - Settled on the user’s delegation 2026-11-19: machine conditions in the manifest are Sysl’s
condition language (symbols,
!,&&,||, parentheses), over the closed setmacos,linux,posix,aarch64,x86_64, asifon an entry ofdependencies,sysl-dependenciesandc-librariesand on a feature (where it says only where the feature exists), checked symbol by symbol when the manifest is read;package.targetslists the targets a package supports (all by default);installmay be a block of sentences by condition;link-flagspasses flags such as-framework Securityas written.avin tidyandavin vendoranswer for every target. WHY: one condition language across Avin’s manifest, Sysl’s manifests and the Sysl dependencies Avin hands to Sysl; checking every symbol at read keeps a misspelling from silently dropping a dependency. ALTERNATIVES: per-target blocks (targets.x86_64-linux { dependencies { … } }, which repeat a dependency per target and cannot say “every Linux”); a target name as the condition (if = "x86_64-linux", which cannot say “every Linux” either); Sysl’schoicesand per-target linker keys (machine and image configuration Avin’s hosted programs do not have). - Settled on the user’s delegation 2026-11-19: in source, the file is the unit a machine
selects:
name.<symbol>.avinis read only where the symbol holds, a module exists on a machine where any of its files is read, an import of a module that is not everywhere is allowed only from a file that is read no more widely, andavin checktype-checks once per target where anything differs. Values that differ by machine are written overavin.target.osandavin.target.arch, compile-time constants whose untaken branches fold away, both branches checked on every machine. WHY: it keeps the rule features follow (a whole unit is in or out, nothing in a file changes with the build), so every file means one thing; a module keeps one name and one surface on every machine, and the per-target check proves the surface is there. ALTERNATIVES: Sysl’s#iflines (a file reads differently per machine and the untaken lines are never checked); a constant alone (cannot hold a call only one system declares, since both branches are checked); whole modules per machine in the manifest (amachines { linux { modules = […] } }block, which forces shared code to import a different module per machine);name_linux.avinwith an underscore (collides with ordinary file names that end in a system’s name). Review with the user: the surface syntax: the.linux.avininfix,package.targets, theifkey, theinstallblock andavin.target. - Settled on the user’s delegation 2026-11-19 (closing two Open items): a feature has no
compile-time constant, the module staying the only unit a feature gates. WHY: a feature’s
modules and optional dependencies are absent with it off, so a branch on
feature("x")could not type-check against them; a machine constant works only because every machine’s standard library is whole. ALTERNATIVES: afeature("x")constant folded away (fails to check, as above); line gates (the conditional compilation the features design refused). A module is listed by one feature only; a part two features share becomes a feature bothenables. WHY: every gate stays one feature, so the import check stays one question. ALTERNATIVES: a module on while any of its features is on (the import check would have to reason about disjunctions, and a module’s presence would depend on combinations). - Found while surveying, not fixed here (no runtime run is allowed on this branch): the DNS
lookup’s pipe sets descriptor flag
2(runtime/avin/rt/lookup.sysl,CloseOnExecFlag), butFD_CLOEXECis1on macOS and on Linux, so the pipe is inherited by a child started during a lookup. macOS hides it, starting children with every other descriptor closed; Linux does not. It is the first item of the plan.
- Settled on the user’s delegation 2026-11-19: Avin’s targets are
-
Settled on the user’s delegation 2026-11-19 (the user approved moving extractors onto a trait the same day; branch
extractor-trait): an extractor is a value whose type implements one of three core traits,Extractor[-A, +B](unapply(value: A) -> Option[B]),BoolExtractor[-A](unapply(value: A) -> bool) andSeqExtractor[-A, +S](unapplySeq(value: A) -> Option[S]), inlibrary/avin/extractor.avin; the pattern checker finds the conformance (extractor_instancesincheck.sysl) and calls the trait’s method, a class’s or data type’s own implementation directly, so a method merely namedunapplyno longer makes an extractor. The pattern syntax, the three result shapes, coverage (an extractor never counts) and refinement (an extractor learns no equalities) are unchanged, and the methods keep the namesunapplyandunapplySeq. A type implements each trait at one type argument (the rule for every trait with instance members); the trait whoseAtakes the matched value serves, anunapplytrait beforeSeqExtractor. A type’s name is no extractor. A value implementing none is reported with the trait to implement, worked out from the type’s ownunapplyorunapplySeqwhere it has one, or with the three traits and their methods. WHY: the user’s rule that Avin is sound and nominal, which the soundness audit found broken here by a lookup by name; as ordinary traits, extractors also become first-class: held in a value of the trait’s type, passed as a parameter, bounded on a type parameter, implemented by a data type through an impl, inherited by a subclass, with the variance a function’s argument and result have. TheSofSeqExtractoris left open rather than bounded bySeq, so aListstays aListfor itsrest*and list patterns; the pattern asks for a sequence where it is used. ALTERNATIVES: a marker trait with no members, the method still found by name inside it (half nominal; a value of the trait’s type could not be matched); one trait with the result shape as a type parameter (the three shapes are different methods);unapplykeeping its role by name with a modifier (not a trait, so no extractor values). Review with the user: two things the structural rule allowed are gone: an extractor object with a generic method,object Pairwithunapply[A](xs: List[A]), which no trait instance can name, is now a generic class used through a value (val pair = Pair[A](),pair(a, b)); and one object withunapplys overloaded on several input types now picks one input type per trait. Each implementation is also writtenoverride, as every trait member’s is. -
Settled on the user’s delegation 2026-11-19 (built on branch
builder-trait; the move onto a trait approved by the user 2026-11-19): a collection literal finds its builder through the core traitBuildable[A], never by a method’s name (literals). The trait has one member,static newBuilder() -> Builder[A, Self];Ais the element a literal gives the builder, a map’s(K, V)pair. A literal where a typeCis expected is built byC.newBuilder()where an impl ofBuildabletargetsCitself, or whereCis a type parameter bounded by it (make[C: Buildable[int]]() -> C = [1, 2, 3]); otherwise it is the defaultVector,SetorMap, built through their own conformances. A companion object’snewBuilderbuilds no literal. Every library collection implements it, its impl calling the companion’snewBuilder, which stays the public way to get a builder (Vector.newBuilder[int]()); a repeated parameter’s vector is built throughVector‘s conformance too. An expected collection (anIterable, or a type whose companion has anewBuilder) that is neitherBuildablenor an instance of the default is reported by the trait it lacks: “a sequence literal cannot buildStack[int], which does not implementBuildable…”. WHY: the user’s goal is a sound, nominally typed language, and a literal that called whatever its expected type’s companion namednewBuilderwas the last structural lookup the soundness audit left; a trait is a stated promise, checked where it is made. One trait for sequences, sets and maps, parameterized by the element rather than by a type constructor, serves every collection the library has:BitSet(aBuildable[int]with no parameter of its own),TreeSet(anOrdbound on its impl), maps (pairs), traits (Set,SortedMap, building their default kinds), and any program’s collection, with or without a companion, from any module, asFromIntegerdoes for integer literals. The conformance is the type’s own: aTreeSetexpected is built byTreeSet‘s impl, never bySortedSet‘s orSet‘s, since those would make a different collection. ALTERNATIVES: a constructor trait on the companion,trait IterableFactory[C[_]]withnewBuilder[A]()(cannot expressBitSet, which takes no parameter, norTreeSet‘sOrdandHashSet‘sEq & Hashelement bounds, and needs a second trait for maps); two traits, one for sequences and sets and one for maps (the element type already tells a pair from an element, so the second adds nothing); removing the companions’newBuilderand calling the static asVector[int].newBuilder()(breaks every call site in every avin-lang repo for no gain in soundness). A trait type’s own conformance builds where the trait type is expected (SortedSet,Set,Map,SeqMap, so{}where aMapis expected is the empty map throughMap‘s own impl), and an impl for one instance,impl Buildable[int] for Count[int], builds that instance only;Count[string]expected is the error naming the trait. The companionapplystays an ordinary method (Deque(1, 2, 3)): its repeated parameter’sVectoris already built throughVector‘s conformance, so it meets the trait where a literal does, and each collection keeps the cheapest way from that vector to itself. ALTERNATIVES forapply: rewriting every companionapplyover its ownnewBuilder(no gain in soundness, and slower whereapplyconverts the vector directly, asArray‘stoArraydoes); astatic apply(xs: A*) -> SelfinBuildablewith a default body (makesC(1, 2)callable on a boundC: Buildable[int], but adds a second member every program’s impl inherits, andC.newBuilder()already serves that). Review with the user: the nameBuildable, and whether the companions’newBuildershould eventually be the static member alone. -
Settled on the user’s delegation 2026-11-19 (branch
train-ay, reconcilingbuilder-traitwith the comparisons of ranges and literals that predate it): a type only suggested to a collection literal, by another operand of==,!=or an ordering, leaves the literal its default where no literal builds that type, so(1 .. 3) == [1, 2, 3]is aRangecompared with aVectorby their elements, as beforeBuildable; a type demanded of the literal (a declaration, a parameter, a result, an ascription) still reports the trait it lacks,val r: Range = [1, 2]. WHY: the suggestion exists so a literal compares like with like where it can (xs == [1, 2]withxsaList); where it cannot, a literal of the default compares the same bySeqequality, and an error there would refuse a comparison that has an obvious meaning. ALTERNATIVES: refusing the comparison and asking for.toVector(breaks established programs for no soundness gain); makingRangeBuildable(a literal cannot promise a range’s even step, so its builder would have to fail at run time). -
Settled on the user’s delegation 2026-11-19 (branch
train-ay, reconcilingbytes-sendable‘sobject Isolatedwith constructors used as values): a class’s companion object that declares noapplyleaves the name the class’s constructor where a function is expected, as in call position, soval mi: (Vector[string]) -> Isolated[Vector[string]] = Isolatedand[1, 2].map(Box)make values; elsewhere the name is the object. WHY: adding a companion with unrelated members (Isolated.move) must not take away the constructor value its class had. ALTERNATIVES: the object always (breaks every such value when a companion is added); an error asking to choose (nothing is ambiguous where the object is not a function). -
avin repl, an interactive session (branchrepl, 2026-11-19; approved by the user the same day). The surface is in getting started.- Settled on the user’s delegation 2026-11-19: a session is one growing program, built and run
whole after each input; earlier inputs run again, their output passed over. Imports go to the
program’s top, type declarations below them, everything else into
main; the program writes a mark before the newest input and one after it, and only what lies between is shown. WHY: Avin compiles a closed world — one LLVM module with the library, monomorphized instances, devirtualized calls and per-program type descriptors — so loading each input as a shared object into one live process (keeping the heap, globals and threads) needs separate compilation across units: instances shared or duplicated between units, type identity across them, the collector’s roots registered per loaded unit, and the runtime moved into the host. That is a compiler architecture, not an item. Replaying costs an input’s side effects repeating unseen, values computed afresh (random, time) differing from the ones shown, and run time growing with the session; each input still builds in about a second at-O0through the instance cache. ALTERNATIVES:dlopenper input into a live process (the right end state, above); an interpreter over the checked program (a second semantics to keep equal to the compiled one); replaying with the earlier inputs’ effects suppressed (not possible for effects outside the process). Review with the user: whether the live-process design is wanted next, and how soon. - Settled on the user’s delegation 2026-11-19: each code input is a block nested in the one
before it (
if truearound the rest), soval xentered again hides the earlierxfrom the later inputs, as a block’s local does, and the earlier inputs keep thexthey saw; a local function entered again does the same. WHY: Avin forbids a secondvalof one name in one block; nesting gives the hiding every interactive language has without renaming anything. ALTERNATIVES: renaming earlier bindings (rewrites what the user typed, and diagnostics show other names). - Settled on the user’s delegation 2026-11-19 (branch
repl-2; replaces “functions are local functions ofmain“ and “a type declared again replaces the earlier declaration”): each declaration of types, and each function orvalthat uses no local ofmain, is a module of the session’s own (avinrepl.c3), which imports, by name, the newest of each name the inputs before it gave, and every earlier module whole (so their extensions are seen). Such a function orvalis hoisted: a class, trait or function entered after it calls or reads it. A hoisted function is also written intomainwhere it was entered, and a hoistedvalread there under its name (val base = avinReplC2.base), so code inmainsees every name in the order entered, exactly as before. A name entered again hides the earlier one from every later input, module or code, and a module entered before keeps the one it imported: a class callingtwicekeeps thetwiceit was declared after. “Uses no local” is the checker’s answer, not a guess: the input is first checked and run as code ofmain, and hoisted when none of its references resolve to a local ofmainother than a hoisted input’s. A hoisted input is written as a module only once a declaration of types comes after it (nothing else can reach it there), so a session of code alone checks and builds no extra files; one that does not check as a module when a declaration first needs it stays code ofmain, and the declaration is checked again without it. A function orvalthat uses a local stays inmain, and avar, alazy val, a destructuringvaland an input of several statements stay there too, out of the modules’ reach; a module never imports a name whose newest declaration is such a local.mainimports the newest of each type’s name, so code there sees a type declared again in place of the old one, and the new declaration is refused where earlier code ofmainno longer checks against it. An impl of a type or trait the session declared joins that declaration’s module, where a conformance has to be and a plain impl’s methods are the type’s own; any other impl is an extension in a module of its own. A session import binding a name a module gives is left out of the later modules, the module’s name being the nearer. A hoistedvalis computed beforemainwhen the session runs again, which is not seen: an earlier input’s output is passed over. WHY: a declaration can only reach what is declared at the top level of some module, and modules are how Avin scopes names, so one module per input gives declarations the same hidingmainhas, with nothing renamed and every diagnostic in the user’s own names; and each module’s text is fixed once entered, so its instances stay in the build cache. ALTERNATIVES: one top-level module for every declaration (a function orvalentered again would replace the earlier one under the inputs that used it, and a value computed from it would change when the session runs again); hoisting by renaming (twice$2; diagnostics and types show the other names); hoisting by a syntactic test of the free names (a parameter named like a local would keep the function local). Review with the user: that code ofmainsees a type declared again where modules keep the old one (Avin has no local types to hide it with), and whether avarshould be reachable from declarations too (a module-levelvarchanges what threads may read). - Settled on the user’s delegation 2026-11-19: an expression’s value is kept as
resNand shown asres0: int = 42, by its type’sDebugthroughAny(a string quoted, a type with noDebugby its name, a function as<function>); avalorvarshows its own name, a local function its header, a type declaration its header; an expression of typeunitshows nothing and takes no number. The type is the checker’s, as hover shows it. ALTERNATIVES:Display(a string unquoted reads like output);itfor the last value only. - Settled on the user’s delegation 2026-11-19: an input ends at the end of its line unless a
bracket is open, the line ends with an operator,
=or a comma, or the input opened a block — a type’s declaration, a line the parser finds unfinished at its end (if x > 0,f(n: int) -> int), or a local function’s header with parameters (log(m: string), which alone reads as a call) — which an empty line ends.greet()alone is a call; a function of no parameters opens its block with a result type or=. ALTERNATIVES: a continuation character; always waiting for an empty line after an indented line (one more Enter for every one-line input). - Settled on the user’s delegation 2026-11-19 (branch
repl-2, replacingsysl.term.edit, which edits one line and completes nothing): at a terminal an input is edited whole by the session’s own editor (repl_editor.sysl, oversysl.term.keys): Enter enters an input the completeness rule above finds complete, wherever the cursor is, and otherwise breaks the line at the cursor and goes on under a|prompt, indented as the line above and two more after a line opening a block (if,else, a header, an open bracket, a trailing operator; a trailing comma keeps the indentation); Backspace over an indentation takes back two columns; the arrows move through the input’s lines and, past its first or last, through the inputs entered before (500, whole); Ctrl-A/E/B/F/P/N/K/U as usual, Ctrl-C drops the input, Ctrl-D on an empty one ends the session. Lines wider than the terminal are drawn over as many rows as they take (its width is asked at each drawing). Raw mode only while an input is read, so a running input gets Ctrl-C; read from a pipe there are no prompts, and lines are taken one at a time as before, so a scripted session’s output is what its inputs write. An input’s standard output and error reach the session as one stream, in the order written. No new C dependency. ALTERNATIVES: linenoise (a C dependency); a line at a time with a continuation prompt (an earlier line cannot be changed); entering on an empty line always (one more Enter for every one-line input). - Settled on the user’s delegation 2026-11-19 (branch
repl-2): Tab completes from the language server’s completion (completion.sysl): the input is placed in the session’s program as it would be entered (an import among the imports, a declaration of types as a module of its own, other code inmain), the word at the cursor replaced by the stand-in, and what the check finds there is offered: names in scope (locals ofmain, hoisted inputs, types, imports, the core library, and the keywords an expression may begin with), a receiver’s members after a., modules afterimport. The names are ordered nearest scope first, then by name; Tab writes what all of them begin with, and when that adds nothing and there are several, lists them under the input. Tab with only spaces before the cursor indents. The session’s own names (avinReplShow, the module aliases) are never offered. ALTERNATIVES: names collected from the session’s text (no members, no types of expressions); a menu to choose from (a larger editor). - Settled on the user’s delegation 2026-11-19: in a package, or a directory holding a program,
the session’s program is that program with its root module replaced by the session, so its
modules import as they do from
main, and its dependencies, Sysl packages and C libraries come with it.:load <file>enters a file’s imports and top-level declarations one at a time as if typed; itsmainbecomes a local function to call. ALTERNATIVES: keeping the root module (itsmaincollides with the session’s);:loadrunning the file’smain(it can be called).
- Settled on the user’s delegation 2026-11-19: a session is one growing program, built and run
whole after each input; earlier inputs run again, their output passed over. Imports go to the
program’s top, type declarations below them, everything else into
-
Settled on the user’s delegation 2026-11-19 (proposed 2026-11-13 on branch
given-design, the design approved by the user 2026-11-13 and its build approved 2026-11-19; built from branchgiven-1on): contextual parameters are for context values, never for conformances (contextual parameters). Ausingparameter is filled from agivenin scope; a bound is met only by the type’simpl, a given never overrides or adds to one, a contextual parameter’s type names no type parameter, and a given has none. Why: Avin already resolves trait instances coherently throughimpland bounds, so letting a given fill a bound would be a second way to supply an instance, and an incoherent one: aTreeSetbuilt under one ordering and searched under another. Under the principle the user set the same day (“the ultimate SOUND, NOMINALLY typed, compiled, garbage-collected high-level language”), coherence is not negotiable, so givens carry what conformances cannot: a transaction, a logger, a request, a clock. A non-natural order stays an argument of its call (sortWith,sortBywithReverse). Alternatives weighed: ausingof a trait type filled by a given, falling back to the impl (two ways to do one thing, and incoherent across values built under different scopes); givens for bounds only with priorities (the search and ambiguity rules that cost compile time and predictability); no contextual parameters at all (every layer threads a logger by hand). Review with the user. This is the central choice. -
Settled on the user’s delegation 2026-11-19 (proposed 2026-11-13 on branch
given-design; built on branchgiven-1): every given is named; no anonymous givens.given tx = db.begin(),given log: Logger = …. Why: one way to declare one; the name is what a call passes explicitly (tx = …), what a diagnostic names and what another file imports. Alternatives weighed: anonymousgiven RequestContext(id)(a second form for the same thing, and an import with nothing to name);given existingNameto make a value a given (a second way to make a lambda’s parameter one, besideusing). Review with the user: anonymous givens are the likeliest to be missed. -
Settled on the user’s delegation 2026-11-19 (proposed 2026-11-13 on branch
given-design; built on branchgiven-1):usingis a trailing section of the one parameter list,f(a: A, using tx: Tx, log: Logger), passed explicitly only by name. Why: Avin has one parameter list per function and named arguments already; positional passing would let an argument meant for an ordinary parameter land on a contextual one. Alternatives weighed: a second parameter listf(a)(using tx)(Avin has no curried lists);usingon each parameter (repetition); positional explicit passing (ambiguous next to defaults). -
Settled on the user’s delegation 2026-11-19 (proposed 2026-11-13 on branch
given-design; to be built at step 3 of the plan): resolution is lexical, nearest level wins, two fits at one level are an error: blocks, then enclosing functions’ and lambdas’usingparameters, the class constructor’s or actor’s, the object’s givens, then the module’s own givens with the file’s imported ones; fit is nominal conformance; then the parameter’s default. Why: one deterministic answer per call, decided where it is written and shown by the source; no ranking by specificity, so no rule a reader must simulate. Alternatives weighed: exact-type matching only (a givenFileLoggercould not fill aLogger); most-specific ranking across levels (search, and surprising winners); one flat scope (a block could not narrow a module’s given). -
Settled on the user’s delegation 2026-11-19 (proposed 2026-11-13 on branch
given-design; to be built at step 4 of the plan): a given is seen in another file only when imported by name (directly or through an export); importing the module whole does not bring its givens. Why: a given changes what a call receives with nothing written at the call, so the file says which; a library adding a given then cannot change an existing call elsewhere. Alternatives weighed: givens seen through any import of their module, as extensions are (silent changes of meaning); a.givenwildcard import (Avin has no wildcard import). Review with the user. -
Settled on the user’s delegation 2026-11-19 (proposed 2026-11-13 on branch
given-design; built on branchgiven-1): a given’s type is a nominal type of the program (a class, an object’s type, a trait used as a type, adatatype, closed type arguments); built-in types, tuples, function types and unions are refused, and a given is aval. Why: nominal typing — a value fills a parameter because its type declares what it is, not because a common shape such asintfits; and avargiven would share a box across closures and threads. -
Settled on the user’s delegation 2026-11-19 (proposed 2026-11-13 on branch
given-design; built on branchgiven-1): givens are declared in blocks, at a module’s top level and in object bodies; classes and actors take context asusingparameters of their constructors (private fields, givens in their bodies). Nogivenin class, trait ordatabodies, and none ofdatavariants,main, tests, hooks or bindings take ausingsection. Why: one place per kind of declaration; a class’s context comes from whoever makes it. -
Settled on the user’s delegation 2026-11-19 (proposed 2026-11-13 on branch
given-design; to be built at step 5 of the plan): lambdas and function values. A lambda resolves where it is written and captures the givens it uses; its parameters afterusingare givens in its body but positional in its type; function types have nousingsection; a function taken as a value has its section filled where it is taken. Why: a function value is called with positional arguments only (as for names and defaults), and lexical capture keeps one rule for every closure. Alternatives weighed: contextual function types ((using Tx) -> R, a new kind of type); agiven txstatement in the lambda’s body (a second way). Review with the user: contextual function types are what would makedb.transaction { insert(row) }need no parameter. -
Settled on the user’s delegation 2026-11-19 (proposed 2026-11-13 on branch
given-design; to be built at step 5 of the plan): a given does not crossspawnby itself; a closure that uses one captures it and is checked as any capture (sendability, novar). Why: a given is a lexical value, not thread-local state, so the sharing rules see it. Alternatives weighed: an inherited per-thread context (dynamic scoping, invisible in the source). -
Settled on the user’s delegation 2026-11-19 (proposed 2026-11-13 on branch
given-design; the section built on branchgiven-1, its filling at step 3 of the plan): contextual parameters may have defaults, used where no given fits, and every default of the function sees the contextual parameters, which are filled first. The section takes no part in choosing an overload. Why: a default is the natural fallback (using clock: Clock = SystemClock), and resolving after the overload is chosen keeps the cost of a call linear and its errors at the chosen function. No standard-library API adopts contextual parameters in this design; adopting one (anExecutorforFuture(body)) is its own item, sinceex.future(body)already exists and the two would be two ways. -
Settled on the user’s delegation 2026-11-19 (branch
given-1): an opaque type may be a given’s and a contextual parameter’s type, beside classes, objects, traits used as types anddatatypes. Why: the refusal of built-in types exists because a givenintwould be given wherever anyintis asked for; an opaque type is a nominal type of its own (opaque type UserId = long), which only what asks for aUserIdreceives, so it has none of that problem, and “avin is for everyone” favours the wider rule. Alternatives weighed: refusing it as the design’s list did (a wrapperdatatype would be needed for a value an opaque type already names). Review with the user. -
Settled on the user’s delegation 2026-11-19 (branch
given-1): wheregivenandusingbegin their forms.givenbegins a given where a name and its:or=follow it; beforeval,varor a capitalized name it is read as a given and reported (avalalready; never avar; every given named); everywhere else it is a name.usingbegins a section where a name (or a class parameter’s modifier) follows it in a parameter list, also in a parenthesized lambda and asusing tx ->, alone or as a call’s trailing lambda. Why: the smallest test that keeps every existing use (args.given(…),given = 3,given(x), a parameterusing: Mode) meaning what it did; the capitalized-name case turns the likeliest mistake, an unnamed given, into its own message rather than a parse error. Alternatives weighed: reserving both words (breaks existing programs); readinggivenbefore any name as a declaration (an infix callgiven max bon a value namedgivenwould change meaning). -
Settled on the user’s delegation 2026-11-19 (branch
given-1): a contextual parameter has a name, is neither by-name nor repeated, and a class’s is written withoutval,varorprivate; a repeated parameter may come just before the section. Why: it is passed explicitly only by name; a given is one value already made, so by-name evaluation and repetition mean nothing for it; a class’s contextual parameter is a private field and a given by definition. The section comes last, so a repeated parameter is last of the others (all(xs: int*, using tx: Tx)). A data variant takes no section, reported where it is parsed. -
Settled on the user’s delegation 2026-11-19 (branch
given-3): a local function’s or a lambda’s contextual parameters are a level of the scope walk between its body and the block it is written in, so they beat the givens of the blocks around it and lose to the givens of its own body’s blocks. Why: the chapter listed “the enclosing blocks” before “the contextual parameters of each enclosing function or lambda”, which read literally would let a block outside a local function hide the function’s ownusingparameter, the value its caller chose for it; resolving by lexical nearness is the rule every other name follows, and it is the reading of “nearer level wins” a reader expects. Alternatives weighed: every block first, then every function’s parameters innermost out (the literal list, wherehelper(using tx: Tx) = tag()written in a block withgiven t = Tx(…)would ignore its owntx). -
Settled on the user’s delegation 2026-11-19 (branch
given-3): the section’s defaults are computed before the other omitted defaults, and a contextual parameter’s default sees the section’s parameters before it, not the ordinary ones; an ordinary default sees the parameters before it and the whole section. Why: the chapter has ordinary defaults see the section, so the section must be complete first; a section default that also saw ordinary parameters could depend on an ordinary default that depends on it, a cycle with no order to compute it in. Alternatives weighed: a section default seeing every parameter before it in the list (needs an order that interleaves the two kinds, and the cycle above is then a compile error to explain); a section default seeing nothing of the call (using tx: Tx, clock: Clock = Clock(tx.start)lost). -
Settled on the user’s delegation 2026-11-19 (branch
given-3): a positional argument past the parameters before the section is the “passed by name” error when the call writes no more positional arguments than the function has parameters, and the argument-count error otherwise (tag(tx, tx)fortag(using tx: Tx)says it takes 0 arguments, not 2). Where a repeated parameter comes before the section, every positional argument is the repeated parameter’s, so atxwritten last is a type error there, and the section is still filled. Why: the error names the likeliest fix, naming the argument, where a call has one positional argument per contextual parameter; beyond that it was not meant for the section. Alternatives weighed: always the “passed by name” error (wrong advice for a call of too many arguments). -
Settled on the user’s delegation 2026-11-19 (branch
given-4): a given a module exports by name is a given of that module’s own files too, beside the givens it declares, at the module level of the scope walk; a given and an export of it, or two imports of one given (current as txandkit.{current}), are one given, never two that fit. Why: an export names the given as explicitly as an import does, and a module’s files already see every name it exports as one of their own, so the rule “a file sees another module’s given only where a name of it is written” holds for both. Alternatives weighed: an export presents the given to importers only, its own files needing an import as well (a second line naming the same given, with nothing the reader learns from it). Review with the user: whether exporting a given should also bring it in for the exporting module. -
Settled on the user’s delegation 2026-11-19 (branch
given-4): the “no given” error’s hint names every public given, of the parameter’s type or one conforming to it, that a module the file imports whole declares or exports and the file does not already import, each as its own clause after;(`kit` declares the given `kitTx`, which this file does not import: `import kit.{kitTx}`), under the name that module presents it by. A private given is never offered, since it cannot be imported. Why: the hint is there to say which import to write, so it offers exactly the imports that would compile and fix the call. Alternatives weighed: the first such given only (hides the choice when two modules offer one); every module of the program (suggests modules the file never named). -
Settled on the user’s delegation 2026-11-19 (branch
given-4): imported givens enter the instance cache through the module-level value each filled call reads, with no extra key input: a filled argument is a read of that value in the typed tree, and a key already holds the interface of every module-level value its tree reads, so an edit of an imported given’s type lowers each caller it fills again and an edit of its value alone does not. Alternatives weighed: a key input listing every given a file imports (re-lowers callers on edits that cannot change their text). -
Settled on the user’s delegation 2026-11-19 (branch
given-5): a function, method or constructor with ausingsection, taken as a value, is a closure calling it as a call written where the value is taken would: its type is the parameters before the section, the section is filled from the givens in scope there, which the closure captures, and a contextual parameter no given fills takes its default, computed at each call of the value.rows.map(insert)is exactlyrows.map(row -> insert(row)), so a value with no given in scope is the call’s “needs aTx“ error, two that fit are the call’s “two givens” error, an overload is chosen by the parameters before its section, and a value cannot take the section explicitly (a lambda does:(r, t) -> insert(r, tx = t)). A method whose parameters are all in its section is called with()as one of no parameters is:s.currentwith no function type expected is the “called with()“ error, andval f: () -> int = s.currentis its value. Why: the chapter’s own equivalence, taken literally, gives every other answer: the given is captured as any read of it is, so thespawn,@sendable, executor and@threadedchecks name it with no new rule, and a default is computed where an omitted argument’s always is, at the call. Alternatives weighed: keeping the section as positional parameters of the value (the step-3 behaviour; the given in scope would be ignored, and the value would not fit the function types it reads as); computing the defaults once where the value is taken (a second time at which a default runs, unlike every other default); a value of a method of only contextual parameters made where no function type is expected (s.currentwould then quietly be a function where a call was almost certainly meant). -
Settled on the user’s delegation 2026-11-19 (branch
given-5): an actor’susingsection is held toSendableas any actor parameter is, filled where the actor is made, by the given in scope, by name, or by its default, and its parameters are givens in the actor’s body and itsreceive. Why: an actor’s parameters are carried to it by its behaviour, so the section is checked where the actor is declared, once, with the message every other parameter gets. Alternatives weighed: none that keeps one rule for actor parameters. -
Settled on the user’s delegation 2026-11-19 (branch
given-6): an editor sees each argument a call’susingsection was filled with at the call’s name. Hover on the name shows the function’s signature, then “Filled from givens:” and one line per filled parameter as it would be written, with the given’s declaration beside it (tx = current // val current: Tx); go to definition answers the function first and then each given, in the section’s order (an editor shows a list to pick from); a given’s references and highlights include the calls it filled, at the call’s name; a rename of a given never edits a call it filled, since nothing there spells it; and the call’s name stays one semantic token, the function’s. A signature shown by hover or completion writesusingonce before its section (send(n: int, using tx: Tx, log: Log)), and a completed call’s snippet leaves the section out. Why: a filled argument has no text of its own, and the call’s name is the one place a reader looks at when asking what the call receives; listing the givens in definition makes the jump one step from where the question arises. Alternatives weighed: an inlay hint after the call’s parentheses (insert(2)⟨tx = current⟩; cleaner to read, but a separate request most editors show only when asked, and nothing here serves inlay hints yet); definition going to the given alone (loses the function, the commoner question); leaving filled calls out of references (then “where is this given used” has no answer). Review with the user: whether inlay hints for filled arguments are wanted as well. -
Settled on the user’s delegation 2026-11-19 (branch
given-6): completion offersgivenandusingwhere a form may begin with them: both among the statement keywords where a name in an expression is being written (a block’s given; ausinglambda,using tx -> …);givenat the start of a line no expression holds (a module’s or an object’s given); andusingat an item’s start in a parenthesized list no expression holds (a parameter list, on its line or a line of its own). A type, a member after a dot and an import offer neither. Why: the checker already tells an expression’s place apart; the other two are read off the text before the cursor, which is all a half-written declaration offers. Alternatives weighed: walking the parsed declaration for a parameter at the cursor (exact, but a half-written parameter list rarely parses); offering both everywhere (noise in types and imports, where neither can be written). -
Guards on
selectarms, andSelectorfor a set of sources known at run time (branchselect-dynamic, 2026-11-19). The gap came from the ssh package (branchpty-forward,Socket.waitWith): relaying a tunnel to a local connection, it could not leave out an arm by a run-time condition (“watchlocal.writable()only while bytes are pending for it”) and spelled out twelve selects, one per combination; and nothing could wait on N connections or N tunnels, which blocks a multi-connectionssh -Land-R. The surface is select and selectors.- Settled on the user’s delegation 2026-11-19: any arm but
elsemay end in anifguard, written as a match arm’s is, after the operation and itsaspattern. A false guard makes the arm absent: not evaluated beyond its guard, not watched, never run, its value never sent. The guard is evaluated first, with the arms’ other expressions, once and in written order, before any arm is tried, so it cannot name the arm’s pattern’s bindings, which no value has yet. WHY: evaluating the guard first lets it protect the arm’s own expressions (conns(i).readable() if i < n) and keeps a value meant for an absent arm from being computed; an arm that is not there should cost nothing. ALTERNATIVES: the guard after the arm’s expressions (a send’s value computed for nothing, and a guard that cannot protect its arm); a guard that sees the received value, as a match guard sees its bindings (it would have to receive before deciding, then put the value back, which a channel cannot do without reordering). - Settled on the user’s delegation 2026-11-19: a select whose every arm is guarded off, with no
afterorelseleft, traps, and so doeswaiton an emptySelector. WHY: only a cancellation could end such a wait, which is almost always a loop’s exit condition gone wrong; the trap names it where it happens, instead of a thread that hangs or a deadlock report later. A thread meant to wait for its cancellation says so with anafteror a channel. ALTERNATIVES: waiting for cancellation (as the brief offered; silent where it is a bug); a compile-time error (guards are run-time values, so it can only be caught at run time). - Settled on the user’s delegation 2026-11-19:
aftertakes a guard;elsedoes not. A false guard onafterleaves a select that waits until an arm runs.else‘s body follows it with no arrow, soelse if c then a else balready means anifthere. WHY: a guardedafteris the “time out only while something is pending” case; a guardedelseisafter 0guarded, which already exists. ALTERNATIVES: a guard onelse(else ifwould read two ways). - Settled on the user’s delegation 2026-11-19: the dynamic form is a library type,
avin.threads.Selector[K: Eq]: entriesreceive(channel, key) -> SelectReceive[T](whosereceived()holds what was received),send(channel, x, key),readable(source, key)andwritable(sink, key);remove(key),removeWhere(p),clear(),size,isEmpty; waitswait() -> K,within(timeout),until(deadline)andpoll() -> Option[K]. The entries stay between waits; a send entry is taken out once its value has gone. Each entry is the arm object aselectblock is read into, and a wait runs the same library loop and the same runtime park on the poller, so there is one wait path. WHY: a set of N sources needs a value the program can build, keep and change between waits, and keys of the program’s choosing answer “which one” without index bookkeeping; mixed kinds (channels and streams) live in one set. ALTERNATIVES: aforarm inselect(for c in conns: c.readable() -> …), which reads well for one homogeneous collection but rebuilds the set every time the select is reached, needs a second arm per kind of source, and adds a binding form to the select grammar; both (two ways to say the same thing, theforarm being sugar the library type can carry later if programs want it); entries answered by index (indices shift as entries are removed); a send entry that stays after it ran (it would send the same value again at the next wait). Review with the user: theSelectorsurface (its name, keys over indices,receiveanswering the entry, a send entry taken out once it ran), and whetherselectshould gain aforarm as sugar over it.
- Settled on the user’s delegation 2026-11-19: any arm but
-
Settled on the user’s delegation 2026-11-19 (branch
stdin-readiness):io.stdin()is aReadiness, any thread may wait on it, andreadAvailable(max)reads only what is there. Source: thestdio-bytesbranch found that the tui package could not move off its own Sysl binding of descriptor 0 (sysl.io.wait.readywith a time limit, then a raw read), becauseio.stdin()had no timed wait and bytes in the runtime’s shared buffer would never show as the descriptor’s readiness; any interactive program (a TUI, a REPL, a language server with timers) needs standard input in one wait with channels and timers. Details settled: (1) Ready means bytes are in the shared buffer (areadLine‘s read-ahead among them), the input has ended or failed, standard input is a file (whose read never waits), or descriptor 0 polls readable;readable()never waits, and answersfalsewhile another thread holds the input lock. (2) Ownership: none. Standard input is process-global, so any thread may name it in a select or aSelector, and several at once; a connection keeps its owner rule. (3) The lock: a select never takesinput_readersto wait. Every select arm on standard input is enlisted on a runtime queue (input_changed) that every reader notifies as it lets the lock go, so bytes another thread’sreadLineleft in the buffer end the wait; one select at a time watches descriptor 0 on the poller (which holds one waiter per descriptor and direction), and hands the watch on, waking the others, when its wait ends; a reader parked on descriptor 0 takes the watch’s place and tells the selects when it lets go. The library is unchanged: the runtime’sselect_watchtakes descriptor 0 by this path. (4)readAvailable(max) -> Result[Option[Array[byte]], IoError]:Someof whatread(max)would answer without waiting, an empty array at the end,Nonewhere a read would wait or another thread is reading; it is a method ofStandardInputBytes, not ofReader. WHY: one wait path for every source; the queue closes the one gap readiness on the descriptor alone leaves (bytes already buffered) without polling;Optionkeeps “nothing yet” apart from “ended”, which a TUI must tell apart. ALTERNATIVES: only the thread that first waits on standard input may wait on it, trapping others (a rule a program could not see, for a resource that has no owner); taking the input lock to look (a select would then wait behind a thread parked inreadLine, past itsafter); a select re-trying standard input on a timer (wakeAt) while another thread reads (polling, and a delay);readAvailableanswering an empty array for both “nothing yet” and the end (ambiguous);readSome/readAvailableon theReadertrait (every reader would owe it, and files and connections have no use for it yet). tui switched in its branchstdin-api. Review with the user: the namereadAvailableand itsOptionanswer. -
Settled on the user’s delegation 2026-11-19 (the user asked for the change, branch
method-chain): a comparison chain’s links may call operator methods; a chain is allowed when every link yieldsbool.lo <= x < hiwithx‘s type defining<=and<as methods is one chain, as it is for built-in comparisons, and links of methods mix with built-in links,==and!=among them. The chain keeps its meaning: operands are evaluated left to right, each middle operand exactly once, and evaluation stops at the first false link. Each link resolves on its own left operand’s type, so overloads are chosen per link (t0 < t <= dcallsInstant < Instantand thenInstant <= Duration). A link whose method yields anything butbool(a query builder’sage < 30yielding a condition) makes the chain an error naming the link, its method and the type it yields, and saying to join the comparisons with&&or parenthesize one;a < balone still yields whatever the method yields. The compiler lowers a method link through the chain’s one lowering: the checker records the link’s resolved call on two unnamed locals, and the chain gives them the operands’ values it already holds. Why: chains read as the mathematics they write, and the house style asks for them wherever possible; the earlier rule’s reason, that a method may yield anything, is kept exactly where it applies, a link that does not yieldbool. Alternatives weighed: keeping the error (forceslo <= x && x < hion types with methods only); allowing any result type and joining links with the result’s own&&(no single meaning for short-circuiting, and a condition builder’s&&is a method too); desugaring method chains into nested&&blocks in the checker (a second lowering of chains to keep in step with the first). Amends “the arithmetic operators … are free method names” above. -
Settled on the user’s delegation 2026-11-19 (built on branch
machine-conditions): the choices machines left open in the manifest.- A feature that does not exist on a machine turns nothing on there, even when a feature that
does exist
enablesit: the selection leaves it out, and what only it would turn on stays off. A feature thatrequiresit is refused there as requiring a feature that is off. WHY: “does not exist” means the same whichever way the feature is reached; turning its modules on through another feature would make it exist after all. ALTERNATIVES: refusing a feature that enables an absent one (makes a cross-machine package spell its enables twice); taking it throughenablesanyway (contradicts itsif). targets = []is refused; a package builds for at least one target. WHY: an empty list is a package nothing can build, and is more likely a slip than an intent. ALTERNATIVES: reading it as every target (the opposite of what it says).- Whether a dependency “reaches further” is asked over the dependent’s targets where the entry’s
condition holds, so
lib { …, if = "macos" }may name a package that builds only foraarch64-macos. The check runs whatever machine the build is for, against the manifests. WHY: an entry the condition leaves out is not in those machines’ builds at all. ALTERNATIVES: refusing on every target of the dependent (forcestargetswhereifalready says it). - A whole workspace resolved for a machine is the members that build for it, so
avin tidyandavin vendorof a workspace answer each target with the members that list it. A workspace’s root, and a package listing notargets, answer for every target. WHY: a member built for Linux alone has nothing to resolve on macOS. ALTERNATIVES: refusing the workspace on the machines some member leaves out. link-flagsare passed exactly as written, in order, with no flag merged with another, after the flags ofpkg-configorlink. WHY: the spec’s “as written”;-frameworkrepeated before two frameworks must stay two pairs. ALTERNATIVES: removing repeats (breaks-frameworkpairs).c-linking‘sstaticanddynamicmay name a C library the machine leaves out, which does nothing there: a library of a package in the build whoseifdoes not hold, or,<package>/<library>, a library of a dependency whoseifleaves it out, named by the dependency’s label (its libraries are not read on that machine, so an unqualified name of one is still refused there). A name that is no library at all is refused on every machine.static-system‘s checks stay per machine. WHY: one program manifest serves every target, so a name meant for one machine must not fail the others, while a typo still fails everywhere. ALTERNATIVES: anifonc-linking‘s entries (a second place to say what the library’s ownifalready says); resolving every target to check each name (a build would resolve three times).--targetis taken byavin checkalone for now, reading every manifest as that machine’s build does;avin build --targetis the cross-build item. WHY: checking builds nothing, so it needs no other machine’s tools. ALTERNATIVES: every command (a build for another machine needs a sysroot Sysl does not have yet).- A condition’s syntax errors name the condition and what is wrong at the place: a symbol,
!or(wanted (at the end or where a character stands), a(never closed, or a word following a whole condition; symbols are lowercase and-belongs to a word, so a target’s name is read whole and refused with the condition it means. WHY: one place and one sentence per mistake, as the manifest’s other errors give. ALTERNATIVES: one generic “not a condition” error.
- A feature that does not exist on a machine turns nothing on there, even when a feature that
does exist
-
Settled on the user’s delegation 2026-11-19 (built on branch
machine-files): the choices files for one machine and the machine in an expression left open.- A literate file is selected as an ordinary one (
watch.linux.lavin), and a file’s name carries one symbol: two parts (watch.linux.x86_64.avin) are refused, naming each, as is a part that is no symbol, on every machine, in a package, a program with no manifest, a dependency and the standard library alike. A file named as a symbol alone (linux.avin) is ordinary. WHY: the spec’s “the part is one symbol”; a.lavinfile is a module’s file like any other. ALTERNATIVES: a compound part as&&of its symbols (a second condition syntax in file names); leaving.lavinunselected (a literate module could not differ by machine). - A program of one file is never selected:
avin run tool.linux.avinruns it anywhere. WHY: the file is named outright, so there is nothing to choose between. ALTERNATIVES: refusing it off Linux (a script would fail for its name). - The import rule asks, for each file read on this machine, every target its root lists that
reads the file, each target’s package read as its build reads it (resolving, and fetching what
the cache lacks, a dependency taken only there). A target whose package cannot be read holds no
file to anything in a build, and
avin checkreports it. “No more widely” is by machine: a file forx86_64may import Linux’s module. A module whose files differ per machine but exist on every machine is imported from anywhere. The rule is checked only where anything differs (a file with a symbol, a manifest entry withif), so other packages cost nothing more. Standard library modules are not held to it, since none is missing on any machine. WHY: the spec’s “for every machine intargets, whichever one is being built”; a dependency’s module names are known only by reading it. ALTERNATIVES: mapping an import to a dependency’s label without reading it (a module’s name need not be its package’s); checking only inavin check(a build would accept what another machine’s build refuses). Review with the user: whether a build may fetch a dependency only another machine takes. - The import’s error names the module, its package where it is another’s, the machines it exists on and its files there, the importing file and the machines it is missing on, and it is the only error at that import (the “standard library’s module is meant” hint is not added beside it).
avin checkchecks once per set of targets that read the package alike (the same files, from the same packages), in the ordertargetslists them; with nothing differing it checks the machine being built for, as before, including refusing a host the package leaves out. A diagnostic every check reports is told once, as it is; one some report gets(onx86_64-linuxandaarch64-linux)after its message; a name that a file of the same module read on another machine declares is told as the spec’sno functionstartis declared in … on …(alsono value,no type). A machine whose package cannot be read is told ason…:and its error. The C unit is built only for the machine the compiler runs on. WHY: one sentence per mistake with the machines it is for, and no other machine’s tools. ALTERNATIVES: a check per target always (the arch-only difference ofavin.targetwould check every package three times); a prefixon…:on every machine-specific diagnostic (moves the headline off what is wrong).avin.target‘s values are declared in the library by its own files (target.macos.avin,target.linux.avin,target.aarch64.avin,target.x86_64.avin), and folding is a lowering of a read of a value ofavin.target: amatchwhose arms up to the taken one are decided by their patterns (variants, alternatives,_, names) compiles that arm alone; anistest against a variant and==/!=with a variant or the other value are decided and fold theifor the left of&&/||over them, as anistest a pattern refutes already does. A guard before the taken arm keeps the wholematch. WHY: the values are ordinary declarations checked like any other, and folding reuses the decided-condition path. ALTERNATIVES: a compiler intrinsic forosandarch(a second way to make a value per machine); folding every compile-time constant (changes the code of every program reading a constant, beyond what was decided).- The language server checks the files of the machine it runs on, so a file for another machine open in an editor is not analyzed as part of its package. A later item may check it for a machine that reads it.
- A literate file is selected as an ordinary one (
-
Settled on the user’s delegation 2026-11-19 (branch
bounded-mailbox): A mailbox may be bounded, given asspawn(b, mailbox = Bounded(capacity, overflow)); atellto a full one drops by the actor’sOverflow, and senders that must know or wait useofferandsend.data MailboxisUnbounded(the default) orBounded(capacity: int, overflow: Overflow),OverflowbeingDropNewestorDropOldest; a capacity less than one traps inspawn.tellkeeps its settled promise, never waiting and never failing, and drops as the policy says, counted byref.dropped() -> long.offer(m) -> Result[unit, SendError]never waits and answersErr(Full);send(m)andsend(m, timeout)park the sending thread until there is room (a timed one answeringErr(TimedOut), a timeout of zero or less beingoffer), as a cancellation point that leaves nothing in the mailbox, waking withErr(Ended)where the actor ends; an actor’ssendto its own full mailbox answersErr(Full)at once.SendErrorisFull,TimedOutorEnded;AskErrorgainsFull, and an ask of a full mailbox completes with it at once under either policy, dropping nothing to make room. What the actor arranged for itself (a watch’s notice, a timer’s message, a piped future’s) goes in outside the bound and is never refused, and stop, restart and escalation are not messages, so no bound holds them back; a restart keeps the mailbox and its bound; messages a stash gives back do not count again.Router.pool(…, mailbox)bounds the router’s mailbox and each routee’s at one capacity, and the router waits for room in the routee it chose (SmallestMailboxonly once every routee is full), so a full pool’s backpressure reaches the router’s own mailbox, where the policy andoffer/sendact. A bounded mailbox is a queue under a lock, so the oldest message may be dropped and senders may wait on a condition; unbounded actors keep the lock-free queue and pay nothing. Why: the bound is a property of the actor, chosen where it is started, as its supervision and executor are; separating the sender’s choice (tellfire-and-forget,offerto know,sendto wait) from the actor’s policy keepstell‘s settled meaning and gives every program its backpressure path (marshal’s queues, a pg pool) with no new wait insidetell; an ask that cannot be delivered answering at once is whatEndedalready does. Alternatives weighed: a capacity and policy onBehaviouror theactordeclaration (the same actor wants different bounds in different places); a third policy that fails thetell(tellanswers nothing, so the failure would be a trap in the sender for the receiver’s slowness); atellthat waits (breaks the settled rule, and deadlocks two actors telling each other);offeranswering abool(cannot tellFullfromEnded);sendas aFuture(the message would still be delivered after its awaiter was cancelled); a dead-letters hook called with each dropped message (needs a typed callback on the mailbox and runs user code inside the sender’stell; a counter is enough to observe overload); counting the actor’s own notices against the bound (a full mailbox would lose a watch’s notice of an end); each routee bounded but the router not (a full pool would make the router drop or block with no policy of the caller’s); a bounded lock-free ring (cannot drop the oldest without the actor’s help, and would cap the actor’s own notices too). Review with the user: the overflow surface (two policies, the policy always written out with no default, no failing policy), the namesoffer,sendanddropped, and the router’s bound being shared by router and routees. -
Settled on the user’s delegation 2026-11-19 (branch
lambda-trailing-arg): a block’s last line that closes a bracket opened before the block ends the block at its first comma: inspawn(() ->…a + f(n), 67108864)the lambda yieldsa + f(n)and67108864isspawn‘s second argument, as on one line. The items after the comma are the bracket’s own (positional or named arguments, collection elements, map entries); every block opened in the same brackets on the way (anif‘s ormatch‘s, an inner lambda’s) ends there too, and a trailing block the line itself opens and closes is stepped over. A tuple the block yields on that line is written in parentheses,(a, b)); a)on a line of its own, a tuple on an earlier line anda, b = b, aon an earlier line are unchanged. Why: the block’s lines read the trailing items as a tuple the block yields, so the call silently lost its argument (the thread got the default stack and yielded a tuple), and the spec’s “a block inside brackets starts a line again” said nothing about the line that leaves the brackets; the rule makes the multi-line form mean what the one-line form means, as thematch-arm rule of 2026-11-15 (“inside brackets a comma ends amatcharm’s one-line body”) did for arms. Alternatives: an error for an unparenthesized tuple on such a line, asking for parentheses either way (safe, but rejects the natural way to write a trailing argument); keeping the tuple (silent wrong code). It changes code that compiled before; a scan of every.avinfile in the avin-lang repos found none relying on the old reading, and code that did now fails to compile (an argument count or a lambda’s type). Review with the user: it changes the meaning of code that compiled before. -
Settled on the user’s delegation 2026-11-19 (branch
link-control; the user: “It should be as flexible as possible. Avin isn’t just for me, it’s for anyone who would enjoy using it.”): a program chooses how each C library is linked in its root manifest’sc-linkingblock, and a C library’s own block says what else links it (C bindings). The program’s block holdsdefault("static"or"dynamic"),staticanddynamiclists of libraries (<library>or<package>/<library>),static-system(-lnames the system provides, linked from their archives) andsearch(where those archives are, absolute or root-relative).static-c-libraries = truekeeps its meaning as the shorthand ofdefault = "static"; saying both is an error, so nothing that builds today changes. A C library gainsfiles(archives and shared libraries by path),search(-Ldirectories, searched for archives when static),include(-Idirectories, since a vendored library’s headers are not wherepkg-configwould say),frameworksandlink-flags(raw, the escape hatch); their paths are relative to the package and may not be absolute or hold a..segment, so a fetched package builds wherever it lands. Static is a promise, dynamic is “as named”: a library linked statically takes no shared library from a search directory (an error names the missing archive, as before, now forlinknames andfilestoo), while one linked dynamically is linked from the flags as given, so a vendored.ais static either way. Why one block: one place says how the program links, and astatic/dynamicpair reads as the program’s sentence (“all static except mlt”). Alternatives weighed: a per-librarystatic = truein the library’s block (the author would decide for every program; refused before and still refused, its test kept); per-library keys inside the program’s owndependenciesentries (a library of a dependency’s dependency has no entry to put it in); a top-levellinkkey as Sysl writes it (reads as one key with the-lmeaning of a library’slink);static-c-librariestaking a list (one key with two types, and no room fordynamic). The command line (--static-c-libraries,--dynamic-c-librarieson build, run, test and check) stands in for the manifest’s default only; a library the manifest names keeps its way, since such a name usually records a reason (a licence, a missing archive) a one-off flag should not erase. Alternative: the flag overruling everything (simpler to state, but--static-c-librarieswould then trip over everydynamic-onlylibrary the program had already answered for). A cachedrun/testbuild is keyed by how each library is linked and by its files, which also fixed the cache reusing a static build after the manifest changed. A library package may saydynamic-only = "<why>", one key for both “must be dynamic” (licence) and “has no archive”: both mean the same to a build and differ only in the reason, which the error quotes. A program that would link it statically, by its default, the flag or itsstaticlist, is refused with that reason and told to name it indynamic; it is never made dynamic silently, because a program asking to be static would then ship needing the library installed. Alternatives: the requirement silently winning over the program’s default (quiet, and breaks the static promise); a requirement the program could override bystatic(a licence is not the program’s to waive); two keys,dynamic-onlyandno-archive(two names for one effect). System libraries stay dynamic unlessstatic-systemnames them; a named one with no archive in the searched directories, or named but linked by no library, is an error. On Linux (not built yet) an archive is still linked by its path; a-lkept dynamic stays-l; astatic-systemname maps onto-Wl,-Bstatic -l<name> -Wl,-Bdynamic;frameworksare macOS’s. A package’s vendored C sources are compiled by the library’ssources(the next entry);fileslinks a prebuilt archive. Review with the user: the surface syntax (c-linkingand its five keys,<package>/<library>naming, the library keysfiles/search/include/frameworks/link-flags, the two flags’ names), and the library-requirement rule (dynamic-onlyrefusing a static program rather than yielding to it, and the program’sstaticlist not overriding it). -
Settled on the user’s delegation 2026-11-19 (branch
c-sources; the gap is link-control’s report: a package could link a prebuilt archive byfilesbut not compile the.cfiles it ships, so a binding of a library distributed as source, sqlite3.c, miniz or stb, needed its user to build an archive for each machine; only a Sysl dependency’s own.cwas compiled, by Sysl): a C library names the C files its package ships insources, and the flags they are compiled with incflags(C bindings).sourcesare paths relative to the package, under the rules offiles(no absolute path, no..segment), and a*matches within one directory, as a workspace’s members do;**is refused, a pattern matching no file and a path that is not there are errors, and the matches are sorted and each file taken once. They are compiled by the clang the C unit is compiled with, for the build’s machine, with-O2unlesscflagsnames a level (whatever the program’s own-O, so-O0and-O2builds share the objects), the library’sincludedirectories as-I, the--cflagsof itspkg-configmodule, thencflags, last.cflagsholds what a package says about its C and nothing about the build: defines (-D,-U), an optimization level (-O), warnings (-W,-w,-pedantic), the standard (-std=) and code generation (-f).-Iand its kin are refused with a pointer atinclude,-Wl,/-Wa,/-Wp,with a pointer atlink-flags, and anything else (the target, the output,-l,-g) as not a package’s to say;cflagswith nosourcesis an error, since it would read as flags of the C unit, which it is not. The objects are linked into the program before the libraries’ link flags, statically, always, whateverc-linking, the command line orstatic-c-librariessay of the library: they are part of the program. Sodynamic-onlybesidesourcesis an error at the entry, andpkg-configorlinkbesidesourcesare allowed (a wrapper compiled against an installed library, a source calling libz). The cache: each object is kept incsources/by a key over the source’s text, its flags (anincludedirectory read as the package writes it, so a package keys alike wherever it is fetched), the target, the compiler’s version andclang --version, and the path (package-relative where inside it) and text of every header it includes, which clang lists (-MD) when it compiles and a record keeps; a source with no record is scanned withclang -Mfirst, so two packages shipping the same file compile it once and link it once.avin run‘s cached executables are keyed by each source’s and recorded header’s modification time. The clangs run at once, one per processor at most: Avin has no job count of its own, and this is the bound codegen units already keep. A source clang refuses is reported aserror: the sourceof the C libraryof packagedoes not compile:followed by clang’s own output, which names the file and the line; warnings of a source that compiles are not shown (a vendored library’s warnings are its maintainers’;-Werrormakes them errors).avin checkdoes not compile the sources; it checks each is there and each pattern matches, as it checksfiles. Per-machine sources are entries with anif: a library whose sources differ by machine is written as one entry for what is common and one per machine (vend-macos { if = "macos", sources = [...] }), using the conditions every entry already takes, rather than a condition insidesources. A header-only library needs nothing new: its package ships the one-line.cthat asks for its implementation (#define STB_IMAGE_IMPLEMENTATIONthen the include) and names it insources. Alternatives weighed: a top-levelc-sourcesblock apart fromc-libraries(the sources belong to the library whose headers andincludethey share, and a second block would repeat them);cflagspassing anything (a package could then name a target or an output and break the build’s own choices);-Iallowed incflags(two ways to sayinclude, one of them able to name an absolute path); the program’s-Olevel (debug builds of the program would rebuild and slow every vendored library, which is not what is being debugged); conditions insidesources(sources { macos = [...] }, a second condition syntax whereifalready serves); keying objects by the source alone (an edited header would be missed) or by its preprocessed text (a preprocessing on every build, even when nothing changed); a shared library built from the sources (they are the program’s, and a static object needs no install). Review with the user: the key namessourcesandcflags, which flagscflagsallows, the default-O2independent of the program’s level, and silencing warnings of sources that compile. -
Settled on the user’s delegation 2026-11-19 (branch
target-keys): every cache entry names the machine it was built for, in its name and in its key. A toolchain has atarget(the compiler’s own machine unless a build names another). Underunits/,shims/,cunit/andcsources/an entry is<target>-<key>; the runtime archive islibavinrt-<target>-<key>.a, in the cache and shipped asshare/avin/lib/<target>/libavinrt-<target>-<key>.a; a program’s directory underbuild/is<name>-<target>-<key>, which holds its executables and its instance cache; the key hashed into each entry also holds the target, and an executable’s record does too. Without a cache directory the compiler’s own machine keeps.avin/buildand another machine uses.avin/build/<target>.avin cache infolists the entries per target andavin cache clean --target <target>removes one target’s. Existing caches are not carried over: an old entry has no target in its name, so no build finds it (it is never misread),avin cache infolists it asuntargeted, and the least-recently-used sweep removes it, so the first build after the upgrade rebuilds. Why: a cross build, or a prefix shipping archives for two machines, must never reuse an object built for the other, and the name makes the target visible toinfoandcleanwithout opening a file. Alternatives weighed: the target in the hash alone (disjoint, butinfoandclean --targetcould not tell targets apart); a subdirectory per target in each kind (the sweep andinfocount entries one level down, and a directory would become one entry holding every object of its target, evicted whole); keeping old names for the compiler’s own machine (a compatibility rule with no reader once a second machine exists, and the rebuild is one build). The.avin/buildfallback keeps its path for the compiler’s own machine so existing programs’ directories do not move, which is the one place an old entry stays valid, and its executable records carry the target so a stale one is rebuilt.avin cleanremoves a program’s builds for every target there, and each target’s directory once it is empty. -
Settled on the user’s delegation 2026-11-19 (branch
prefix-ops; the user approved the feature that day): a data type, a class or a trait may define the prefix!,~and+as methods taking no argument, as it defines-(operator methods).!a,~aand+acalla‘s method of that name where its type, or a type parameter’s bound, has one taking no argument; each yields any type, binds at the prefix level, and is resolved by the one path the prefix-already took. Choices this branch made: a!yielding something other thanboolis allowed, as a method<may yield aCond, so a query builder’s!condis a condition object. In a condition (if,while, an operand of&&or||) the!call must yieldbool, and one that does not is “expected bool, found Cond”, the same message any non-boolcondition gets; the condition then binds no names, since anistest is never the operand of a method!. A method!takes no argument at all, a defaulted one included:!has no binary form, and ana ! breading would be a new infix operator nobody asked for.~and+keep their one-argument overloads fora ~ banda + b. Generic code reaches them through a user trait that declares them (trait Flipwith!() -> Self); there is no core trait for them, since no built-in type’s!,~or+is anything generic code over user types needs, andNegstays the only prefix core trait. Where the type has no such method the operator keeps its meaning: on a data type or a class!a,~aand+aare the errors they were (“expected bool”, “~needs an integer or a byte”, “+needs a number”). The built-in types stay closed: a method!, or~or+taking no argument, onint,real,byte,char,string,boolor a tuple, in an extension or a trait’s implementation, is an error (“a prefix!on bool is the language’s own…”);!is no longer among the reserved method spellings. Two prefix operators written together stay one name (!!xand-~xare the existing “a symbol method has no prefix form” error), so nesting is written! !xand- ~x, as the operator-run rule already said. Alternatives weighed: requiringboolfrom every method!(rules out the query builder the feature is for); core traitsNot,ComplementandPositive(no program asks for them, and each would need an impl for every built-in type); splitting a run of prefix characters such as!!into nested operators (it breaks the one longest-run rule the lexer and++/--rely on). Review with the user: whether!!xshould read as! !xwithout the space. -
Settled on the user’s delegation 2026-11-19 (branch
collection-apply): a collection is made by naming its type and listing its elements.Array(1, 2, 3)was refused; it now works, as an ordinary companionapply[T](elements: T*)in the library (no compiler special case: the repeated parameter infersTfrom the elements, from the expected type, or from type arguments written at the call, andArray()with none is the existing “cannot infer” error). Types that gained the form:Array,Buffer,Deque,ArraySeq,LazyList, the mutableSetandLinkedSet, andPriorityQueue(by the elements’ own order);Vector,List,Queue,Set,HashSet,SortedSet,SeqSet,OrderedSet,TreeSet(immutable and mutable) andBitSetalready had it.Array(1, 2.5)widens toArray[real]; mismatched types are the ordinary argument error. A class that keeps fields its own code fills in (LazyList) no longer offers its constructor to a call outside that code, soLazyList[T]()calls the companion’sapplyand makes the empty list instead of being refused. An empty call with no element type to infer follows the settled rule of 2026-11-04 (generics.md): the covariant collections (Vector,List,Queue,ArraySeq,LazyList) takeNothing, as[]andVector.empty()do, and an invariant or bounded element type (Array,Buffer,Deque, every set,PriorityQueue) is a “cannot infer” error. The refusal of an array’s name with type arguments used as a value (Array[int]) stays, its text now namingArray(a, b). The old refusal of calling an array’s constructor is removed, and the literal[1, 2, 3]is unchanged. Maps are excluded (settled 2026-11-09):Map("k" -> 7)stays refused with its hint to write{"k": 7}, and no pair operator is added.Map((k, v), …)taking tuples already exists and stays; no other map gained a form. Alternatives weighed: a compiler special case treatingName(a, b)as a literal (rejected: the library form needs none, and a program’s own collections get the form by declaringapply). Review with the user: whether the tuple formMap((1, "one"), …)should stay beside{1: "one"}, since it is a second way to write a map that no one needs. -
Settled on the user’s delegation 2026-11-19 (branch
diff):avin.diff, a module of the standard library for the differences between two sequences and between two texts’ lines. It islibrary/avin/diff/diff.avin, a module of its own besideavin.uuid, not part of the prelude, so a program names what it uses (import avin.diff.{diff, unifiedDiff}). The API:diff[T: Eq](a, b) -> Vector[Edit[T]]withEdit[T]the variantsKeep(value),Insert(value)andDelete(value);apply(a, edits), which checks everyKeepandDeleteagainst the input and traps naming the edit;changes;Line(text, terminated)withsplitLinesandjoinLines;LineOptions(ignoreTrailingSpace = false, finalNewline = true)anddiffLines;Hunk,hunks(edits, context);renderUnifiedandunifiedDiff, whose output isdiff -u‘s byte for byte (checked against GNU diff’s on twenty fixture pairs at context 0, 1 and 3). The algorithm is Myers’ O(ND) with the linear-space middle-snake refinement, so memory is proportional to the inputs (three arrays of their combined size, and the script) and never to their product; a run of changes lists its deletes before its inserts, asdiff -uprints them. Choices: edits carry the elements, not indices, so a script is self-describing andapplycan verify it (aKeepholds the first sequence’s element, so a line diff that ignores trailing space keeps the original text); lines split at\nonly and keep a\r, asdiffdoes, so CRLF is a difference unlessignoreTrailingSpaceis set (which ignores a\rwith the rest); a last line with no\ndiffers from the same line with one by default, asdiffreports it, andfinalNewline = falsemakes them equal; two changes share a hunk when no more than2 * contextunchanged lines lie between them; an empty range is writtenstart,0withstartthe line before, a range of one line as its number alone, asdiff -udoes. Alternatives weighed: edits as index ranges (Keep(aStart, bStart, count), more compact for large inputs, but cannot be applied without the second sequence and reads less well in a pattern match); the quadratic table of the longest common subsequence (simplest, but 10,000 lines against 10,000 takes 10^8 cells); a patience or histogram diff (often reads better on source code, but is not shortest and does not matchdiff -u); a prelude placement (every program would carry the namesEdit,KeepandDelete). Tests:library/tests/diff.avin, with every pair of sequences over three values up to four long and random pairs checked against the quadratic table for minimality. Review with the user: the namesEdit,Keep,Insert,Delete,diffLines,unifiedDiffandchanges, and whether a patience diff should join this one asdiffLines‘ option. -
io.inputsandio.inputLines: the files named, or standard input when none. Settled on the user’s delegation 2026-11-19:io.inputs(paths: Vector[string]) -> Iterator[Result[(string, string), IoError]]yields each input as its name and all its text, andio.inputLines(paths)yields the same shape with one line per element. No paths is one input, standard input;-names standard input wherever it stands in the list, and a name is yielded as written, so standard input is"-". Inputs are read as the iterator reaches them; one that cannot be read is anErr(the ordinaryIoError, naming the file) in its place, and the iterator goes on, so a tool reports and carries on, and.collect/?style stopping at the first failure is the caller’s choice. Standard input is read to its end once, so a second-is empty. A file’s lines come from its whole text (readText), standard input’s as it advances. Why: every command-line filter writes this loop, and an element carrying its name serves thename:lineoutput ofgrepand an error message alike. Placed inavin.iobesidereadAllandlines, named as they are. Alternatives weighed:Vectorof results (reads every file before the first line is used, and cannot stream standard input); aSourceof the concatenation (loses where each line came from); stopping at the first failing file (a tool wants to report each); a name of""for standard input (indistinguishable from a named empty string, and-is what the tool was told). Tests:tests/run/io_inputs_files,io_inputs_stdin,io_inputs_lines_stdin. Review with the user: the name"-"yielded for standard input, and files being read whole rather than streamed by line. -
A symbol method may declare its precedence and grouping (branch
declared-precedence, 2026-11-19; the user approved “perhaps declared precedence” in the missing-features list, 2026-11-19). The surface is A declared precedence. Review with the user: the whole surface, the annotation names@precedenceand@groupsRight, naming a level by an operator’s string, and the program-wide rule.- Settled on the user’s delegation 2026-11-19:
@precedence("|")names a row of the existing level table by any operator in it, and@groupsRightmakes calls group to the right with the receiver kept on the left. The rows a method may take are the symbol levels plus&&‘s and||‘s, which a pipe looser than every comparison needs. WHY: no level is added, so the table stays the whole account of how an expression reads, and a reader who knows how|binds knows how a call declared as|binds; naming the row by its operator needs no new vocabulary. ALTERNATIVES: numeric levels (refused: a reader cannot placeinfixl 6without a table of every declaration in scope, and two libraries’ numbers interleave in ways neither author saw); identifier level names such as@precedence(additive)(a second set of names for rows the operators already name); one annotation with a grouping argument,@precedence("^", right)(a positional flag reads worse than a word of its own);@groups(left)as well (a name ending in:would then take its receiver on the right yet group left, a combination nothing needs); nothing new, with documentation (the user approved the feature). - Settled on the user’s delegation 2026-11-19: a declaration belongs to the method’s name
across the whole program, and every method of that name in the program reads alike: an
overload, another type’s method, a trait’s declaration and each implementation either declare
the same reading or one that comes to the same (a method declaring nothing agrees only where
the declaration restates what its name gives); any other is an error naming both, reported at
the program’s method where the other is the standard library’s. WHY: the parse runs before
any type is known, so
a <|> bcannot be read bya‘s type; a module holding a value of the type without importing it must read its calls as the declaring module does, which only a program-wide reading guarantees; and a module’s code cannot change meaning silently when an unrelated library joins the program, because that is an error instead. ALTERNATIVES: by the receiver’s type at each call (needs types at parse time, or a second parse after checking, and makesa op b op2 cunreadable without knowing every operand’s type); visible through imports only, as some languages scope fixity (a module that reaches the type through a function’s result, without importing its module, would read the calls differently from the declaring module); undeclared methods silently following a declaration (another library’s<|>, written for the default reading, would be re-read by a declaration it never saw). - Settled on the user’s delegation 2026-11-19: the compiler reads declarations after parsing every unit with the default levels, then parses again, at the declared levels, only the units that write a declared name, a program with no declaration that changes a reading being parsed once as before. WHY: the declarations are on methods inside the files, so they are known only after a first parse; re-parsing keeps the parser the one place precedence lives, with no tree rewriting pass to keep in step with it. ALTERNATIVES: a fixity-resolution pass over the parsed trees (a second implementation of the precedence rules over every expression form); a lexical pre-scan for declarations (a second, partial parser of class and impl bodies).
- Settled on the user’s delegation 2026-11-19: only a method named by a symbol the language
does not use declares:
@precedenceor@groupsRighton one of the language’s operators (+,|,<), an assignment (++=), a method named by a word, or a function is an error;~,++and--between two operands may declare.@groupsRighton a name ending in:is an error (it groups right already). A comparison andistake part in the rule against mixing groupings now that a right-grouping method can share their level. WHY: the language’s own operators keep one reading everywhere, and every named call binds alike. avin parse,avin fmtand the LSP’s single-file views read one file at a time and so parse it at the default levels;avin check,run,build,testand the LSP’s diagnostics load the whole program and read the declarations.avin fmtkeeps the file’s tokens, so a default reading changes only where it chooses to break a long line.
- Settled on the user’s delegation 2026-11-19:
-
Settled on the user’s delegation 2026-11-19 (branch
bytes-sendable; found by the ssh package onpty-forward, whose relay could hand read buffers to per-connection threads only by copying each into aVector[byte]): an array the program holds moves to another thread withIsolated.move(items), with no copy, and the array carries an owner that every use checks (handing over ownership).move[T: Sendable](items: Array[T]) -> Isolated[Array[T]], onIsolated‘s companion inavin.actors; it covers everyArrayof sendable elements, bytes or not, and nothing else. An array’s header gains an owner word beside its length (eight bytes), zero for an array never moved, which any code that reaches it may use as before, since an array is still not sendable. A move also rewrites the length word for good: its top bit set, the length in bits 32 to 62, the low 32 bits zero. So an element use of an array never moved checks exactly what it did before, the index against the low 32 bits, and a moved array fails that check for every index and goes on, on a path the optimizer is told is cold, to compare its owner;length, a slice, a clear and a copy test the word’s sign as they read it. A move gives it an owner no running code is, by one compare-and-set;takeclaims it for the taker,withfor the code runningfand moves it again after; every use by other code traps with`Array` was moved to another owner: an element read or write,length,slice, a copy into or out of it, an iterator’s step, a C binding’s argument (checked before C sees it), a Sysl binding’s argument (checked as its shim reads it), aByteBlockwrite from it, and a second move. Aliases (a field, a closure’s capture, an iterator) are the same object, so their uses trap as the local’s does; a slice taken before the move is a copy and stays the sender’s; frozen arrays (aVector‘s or anArraySeq‘s) are the library’s own, never moved, and unchecked. Why: an array’s elements are stored inside the object, so a move cannot hand the receiver new storage and leave the sender an empty shell; the only sound zero-copy move of an array other references may reach is one the array itself enforces, and an owner word read beside the length the bounds check already reads keeps the common path to a load and a compare. Handles already move this way, and the messages match. Alternatives weighed: (a) transfer on send, makingArraysendable and moving it implicitly at every send — then an@isolatingbody (a mutex’s value,isolate) could capture an array that was never moved and share it unchecked between threads, so every array would need a real owner from birth and every mutex, pool andIsolateda walk to re-own what it holds; far wider and slower for the same gain. (b)freeze()/toBytes(), an immutable sendable view — still needs the array to refuse later writes (the same owner word), and the relay wants a buffer the receiver can write and hand back. (c) a separateTransfer[T]type —Isolatedalready is the type of “mutable, moving, taken once”, withtake,withand its place in the handover walk; a second type would duplicate it. (d) lifting@trusted_sendable‘s restriction to the standard library — rejected: it would let any package declare an array-holding class sendable with nothing checking the claim, which is a data race, not a gap closed. A compile-time refusal of the sender’s later use was weighed too: it needs uniqueness or alias analysis the checker does not have, and the runtime check covers every alias. The cost, measured on the build that settled it: memory, a million live arrays of 0 to 100 bytes take 0 or 16 more bytes each, by whether the eight cross a 16-byte allocation class (56→56 bytes at 0, 1 and 8 elements; 56→72 at 9 and 16; 72→88 at 32; 104→120 at 64; 152→152 at 100). Time, at -O2: a read loop over an array never moved compiles to the same ten instructions as before; a write loop bounded bya.lengthkeeps an element bounds check the optimizer used to drop, plus a sign test, three predictable instructions an iteration. A first encoding that loaded the owner word at every use was measured (preliminary, eleven interleaved runs, before the benchmark was cut short) at 3% to 54% slower in tight loops, which is why the owner sits behind the bounds check; the encoding that settled was checked in the generated code, not timed. Review with the user: the remaining write-loop check and the memory above, and whetherBuffershould move the same way (its length is a field of its own, so it would need its own owner). -
Settled on the user’s delegation 2026-11-19 (branch
ports-cli): an example of many files,examples/NAME/, is run and its output checked whenexamples/NAME.outstands beside it, and is only built and linked when it has none, as a program that opens a window has none. Its input and expected standard error areexamples/NAME.inandexamples/NAME.err, its expectation lines (// args:,// expect:) in its own files, exactly as a program intests/programs/runhas them. Why: the command-line examples (wordfreq,grep,logsum,dusage,markdown,todo) are directories with a README, and the sidecar beside the directory is the rule the corpus already reads for programs of many files, so nothing new is learned to read one. Alternatives weighed: sidecars inside the directory (a second rule for the same thing); a header line marking a window program as not run (a marker on the exception rather than on the output that makes the check); a separateexamples/run/directory (splits the examples a reader browses by how they are tested). Branchesports-concurrentandports-numericreached the same rule on their own, with the same reasons; the corpus keeps one copy of it. -
Settled on the user’s delegation 2026-11-19 (branch
variant-fn-value): a variant with fields, named and not called, is its constructor as a function value, as a class’s name is.Heard,Event.Heard,events.HeardandSome[int]are each a function of the variant’s fields, in order and all of them (defaults are not dropped, as a class constructor’s value drops none), to its data type, or to a refined variant’s declared instance:["a"].map(Heard),[1, 2].map(Some),adapter(Heard),listener.ask(Stop, patience). Where a function type of as many parameters is expected, its parameters stand for the fields’ (an open one there takes the field’s type, soadapter(Heard)needs noadapter[ChatEvent]) and its result is the type the variant is made at, which also decides between variants sharing a name; elsewhere the value’s type is the variant’s own, and a generic variant whose instance nothing decides is reported (“cannot inferTforSomeused as a value; write it, as inSome[int]“). An expected type the variant does not fit is reported as the whole value’s type against it. Where a value of the variant’s own data type is expected, the call was meant, and the old error stands (“Circlehas fields; call it, as inCircle(arguments)“); a variant without fields is still the value it names. A data type’s companion object of the variant’s name that declaresapply, where a function type is expected, offers the variant beside itsapplymethods, chosen as among overloads, as the callName(…)already chose among them. The value is a lambda made at the use that calls the variant as written, so it captures nothing and is@sendablewhere one is wanted. Why: the smallest rule that makes a variant behave as the constructor it is, with the typing a class constructor’s value already has; ports of concurrent programs reached for it at every actor adapter andask. Alternatives weighed: a value only where a function type is expected (refusesval f = Heard, which a class name allows); a function value that drops defaulted fields (a value has no defaults, and which arity would be ambiguous); keeping the variant out of a companion’s overloads (inconsistent with the call). A lambda whose parameter type nothing but its body decides,adapter(e -> Heard(e)), still reports “cannot infer the type ofe“: the lambda’s parameter is typed before its body is checked, and this item does not widen inference. -
Settled on the user’s delegation 2026-11-19 (branch
scalar-left-ops): a built-in value may stand on an operator method’s left. An impl of no trait adding toint,long(any integer width),real,byte,char,stringorbool, in the type’s module or as an extension, may add a binary arithmetic, ordering, bitwise or shift method whose one parameter is a data type, a class, a trait or an opaque type (any type arguments):impl realadding*(v: Vec) -> Vec = v * selfmakesk * vlegal.l op rwithlbuilt-in androf such a type callsl‘s method when an overload takesr(orr‘s type has no integer/decimal conversion, so the call reports the overloads); resolution is static by parameter types, chains and<-links included. An integer literal on the left isintwhere anintoverload fits, elselong, elsereal(2 * v). A method of such a name on a built-in type taking a built-in type, tuple, function, union or type parameter stays an error (a type parameter could be filled by a built-in type), as does any such method in a trait implementation (impl Grow for real) and every prefix method; an unseen extension’s operator is reported with the module to import. WHY:k * vis how scaling is written, and code was forced intov * k; since the operand is never built-in, built-in × built-in arithmetic can never change meaning, and the rule reuses relaxed impls and overloading, adding no new declaration form. A type that takes integers (BigInt) keeps meeting integers byfromIntegerunless an overload names it. ALTERNATIVES: reflected methods on the right operand (*:or areverse *, as a second dispatch step: two places a reader must look for one operator, and a precedence question when both sides define one); aScalartrait the right type implements (scale(k)), which serves only multiplication by numbers and not"label" + vork < v; wideningFromInteger-style conversion of the left operand to the right type (wrong fork * v, where a real is not a vector). The literal preferenceint,long,realwas chosen over “ambiguous when several fit” so2 * vworks with onlyrealadding*. Tests:tests/run/scalar_left_operators,tests/reject/scalar_left_operator_{declarations,builtin_operands,calls},tests/programs/{run,reject}/scalar_left_extensions. Review with the user: whether an operand of a type parameter bounded by a trait ([T: Shape] k * s) should also dispatch (left out: the right operand must be a concrete program type today), and the literal preference order. -
Settled on the user’s delegation 2026-11-19 (branch
display-width): the standard library measures the columns of a terminal:char.displayWidth,string.displayWidth,padStartWidth(width, ch = ' '),padEndWidth(width, ch = ' ')andtruncateWidth(width, ellipsis = "…"), and a formatted field’s width counts those columns. The rules (library/avin/display_width.avin): a character is 2 when East Asian Wide or Fullwidth; 0 when a nonspacing or enclosing mark, a format character (but the soft hyphen and the marks before a number), or a Hangul vowel or final jamo; 0 when a control character; 1 otherwise, Ambiguous and unassigned included. Text is measured by cluster: a character with the zero-width characters after it, a skin tone after an emoji, and, after a pictograph, each pictograph a zero-width joiner joins; a cluster is as wide as its first character, except that a variation selector 16 after an emoji, or a skin tone, makes it 2, and two regional indicators are one flag of 2. The table is generated from the Unicode Character Database 17.0.0 (the versionsysl.unicodeanswers with) byscripts/display_width_table.avinintolibrary/avin/display_width_table.avin, about 3 KB of base-32 runs decoded on the first character beyond ASCII; ASCII is answered without it. Choices, each with its rationale and the alternatives weighed:- Control characters are 0, not -1 as C’s
wcwidthanswers: a width is summed, and a -1 makes every sum wrong; where a tab or newline moves the cursor is the terminal’s business. Alternative: 1, astuidraws a control as U+FFFD (a drawing choice, not a measure). - Emoji sequences are 2 per cluster, as kitty, WezTerm, iTerm2, Ghostty and the other modern
terminals draw them; older terminals that measure each code point make a family 6 or more. A
variation selector 15 changes nothing, since terminals mostly keep a default-emoji character two
wide under it. A lone regional indicator is 1, its East Asian width. A zero-width joiner joins only
a pictograph to a pictograph, as the grapheme rule GB11 does, so
a+ ZWJ +😀is 3. Alternative: full extended grapheme clusters from the break tablesavin.regexcarries (exact for Indic conjuncts and prepended marks, but the prelude would carry those tables and the widths come out the same for what a terminal draws). - Separate names,
padStartWidth/padEndWidth, besidepadStart/padEnd, which keep counting characters. Alternative: a named parameter (padEnd(10, byWidth = true)), rejected as a flag that changes what the first argument means; or changingpadEnditself, rejected because a sequence’spadToandtake/dropcount characters andpadEndpairs with them. A wide fill character fills two columns at a time and a space fills a column left over; a fill of no width traps (padding by width needs a fill character that takes a column) when padding is needed, rather than looping or silently using a space. truncateWidthnever cuts a cluster, so the result may be a column short ofwidthwhere a wide character does not fit, and adds no padding (pad it after when a fixed width is wanted). An ellipsis wider thanwidthis dropped and the clusters that fit kept; awidthof 0 or less keeps nothing.- A formatted field’s width (
%8s,%-6?,%3c, andFormatSpec.widthinwriteField) counts columns: field widths exist to line columns up, and for ASCII nothing changes. The precision of%sand%?still counts characters, astakedoes. The runtime’stext_widthintrinsic, which counted code points for the field, is removed. Review with the user: this changes the output of an existing program that formats wide or combining text into a field (a CJK%10snow pads four columns less for two ideographs). avin.cli‘s help measures names withdisplayWidthand pads withpadEndWidth. Thetuipackage’s own table (width_table.avin, Unicode 16.0.0) and itscharWidth/textWidthcan become calls to these.
- Control characters are 0, not -1 as C’s
-
Examples of concurrent programs, and what they asked of the library (branch
ports-concurrent, 2026-11-19).- Running an example of many files that has its output beside it: the
ports-clientry above. - Settled on the user’s delegation 2026-11-19:
Response.html(status, text), a response of the typetext/html; charset=utf-8with the text sent as given, besideResponse.textandResponse.json. WHY: a server that renders a page wroteResponse.bytes(status, text.utf8, "text/html; charset=utf-8")by hand. ALTERNATIVES: none kept; escaping the text (it is markup, already written).
- Running an example of many files that has its output beside it: the
-
Settled on the user’s delegation 2026-11-19 (branch
lib-papercuts): four library papercuts. (1) Every hasher ofavin.crypto(Sha256,Sha512,Sha1,Md5) gainsupdate(bytes: Array[byte])and the range formsupdate(bytes, from, until)for a vector and for an array; the array is handed to the digest in place through the@syslbinding, with no copy, and a range outside0 ..< bytes.lengthor withfrom > untiltraps. (2)Channel.lengthanswers the number of buffered values, a snapshot under the lock that is stale at once (documented as a racy observation);sizeis the same number, since the inheritedsizewould consume the channel by iterating it;capacity, the constructor’s bound, is now a publicval(unboundedfor a channel made with none,0for a rendezvous). (3)maxandminare methods of every integer type,real(asmath.max/math.min: NaN when either is,-0.0below0.0),charandbyte, returning the first operand when equal; they are separate fromint.MaxValue/MinValue, which are static members. (4) The mutableMap,Set,LinkedMapandLinkedSetcompanions gain the variadicapply, shaped as the mutableTreeMapandTreeSethave it (Map((1, "a"), (2, "b")); later pairs replace earlier ones, a linked collection keeps first-insertion order). Why: each closes a gap a ported program met and costs one line of surface. Alternatives weighed: aSlicetype for the range form (rejected,(bytes, from, until)is the shapestring.sliceand the collections already use);Channel.lengthas a method with a call (kept parameterless, assize);max/minonly throughOrd(rejected,Ordhas none, and the free functions need an import forreal). -
endcloses a form only when a name follows it, wherever it stands. Settled on the user’s delegation 2026-11-19 (branchkeyword-member-diag):end = atafter a statement with an indented body is the wordendused as a name and gets the one errorend is not defined, instead of anendcloser that swallowed the=and cascaded into an infix-call error quoting the whole enclosing body. The infix-call “no argument” suggestion quotes a receiver that spans lines as…, and is not reported when the receiver is itself an already-reported error. Alternatives weighed: a dedicated “endis a keyword” error (a second message for what the name lookup already says); quoting the last line of a multi-line receiver (a fragment that is not the receiver). -
Settled on the user’s delegation 2026-11-19 (branch
given-grammar): the editor grammar scopesgivenandusingonly where they are keywords.giveniskeyword.declarationat the start of a line (after an optionalprivate) when a name and then:or=follow, and never after., beforeval/var, or as a name (given = 3,given(x)).usingisstorage.modifierwhen a parameter name follows and then:,,,),->or=, in a parameter list or a lambda, and not as a name (f(using: Mode),using -> using,val using = 1,x.using y). Why: the spec makes both words keywords only in those positions, and a line-local TextMate pattern can see exactly them. Alternatives weighed: scoping both words everywhere (colours ordinary names wrongly); a begin/end rule for parameter lists (a parameter list can span lines and nest, which the line-based tokenizer cannot track reliably). Review with the user: ausingwhose parameter name ends its line (a parameter list broken across lines) is not coloured. -
API documentation from the source (branch
avin-doc;avin doc, doc comments).- Settled on the user’s delegation 2026-11-19: a doc comment is the run of
//lines directly above a declaration, past any annotations between: exactly what the language server’s hover already showed, so no second comment form exists and every comment the standard library already wrote is its documentation. It is Markdown with GitHub’s extensions; each line loses its//and one space, and keeps the rest of its indentation. Alternatives weighed: a///form of its own (every existing comment would have to be rewritten, and a plain comment above a declaration would silently stop being shown). - Settled on the user’s delegation 2026-11-19:
avin doc [<program>] [-o <dir>] [--check] [--std-url <url>] [<features>]andavin doc --std: the program is checked asavin checkchecks it, with every feature on, and refused with its diagnostics when it does not check; a page per module (<module>.html), the root module’s declarations onindex.htmlbeside the list of modules, a sharedstyle.cssand asearch.jsthe search box reads, no fetch from anywhere else. The default output is.avin/docbeside the program (the package’s directory, the directory of a program without a manifest, or the file’s), which a package’s.gitignorealready names; a directory is written only when it is new, empty, or holds.avin-doc, the markeravin docwrites, and then its old pages are removed first. Alternatives weighed:doc/beside the program (a directory of hand-written docs by that name would be overwritten);--checkthat also writes (a check in CI wants nothing written). - Settled on the user’s delegation 2026-11-19: what a page shows: every public declaration
of every module but a test module (
@testsfiles and a package’stestsmodule), each with the header hover shows (a function’s, a field’s and a value’s as the checker typed it; a type’s first line as written), a data type’s variants and a record’s fields, a class’s public fields and methods, a trait’s members, an object’s, a type’s public member exports as written (export f.{m, n as k}), the impls a type has with their public methods, and a module’s exports. An impl is listed with its type when the site documents the type among modules of the same kind (the program’s, a dependency’s, the library’s), with the module it is written in named when that is another; otherwise under its own module’s “Implementations”. A method is shown without its type (map[U](…), notOption[T].map[U](…)). A module with nothing public and no comment has no page. Anchors areType,Type.member,function, an overload’sname-2, an impl’sType.impl; a byte outside a name is written~and its hex. - Settled on the user’s delegation 2026-11-19: a type named in a signature links to the
declaration the checker resolved it there, so two types of one name in two modules are never
confused; a name the checker inferred rather than read (an alias’s body shown in its place) links
to the one type of the site with that name, and a type parameter never links. The standard
library’s modules the program reads, and its dependencies’ modules, are written beside its own,
listed apart on the index, so every link stays inside the site;
--std-urlnames where the library’s pages are published instead and writes none of them. Alternatives weighed: always linking to a fixed public URL (a site that breaks offline, and on a version mismatch); never linking into the library (the commonest types of every signature would be dead text). Review with the user: whether the library’s pages should come with every package’s documentation by default. - Settled on the user’s delegation 2026-11-19: links in a doc comment: a link whose destination
is a path of names,
[the map](Vector.map), and[Name]or[`Name`]with no destination, link to that declaration, found as a member of the documented declaration’s type (and its owners’), then in its module, then as a full path or a module’s name, then in the prelude, then as the one declaration of the site with that name (Type.memberincluded). A relative destination that names no declaration must be a page of the site.--checkfails on a destination link that leads nowhere, a backticked[`Name`]that resolves to nothing, and a fenced block with no language oravinthat parses neither as declarations nor as the statements of a function body; a bare[words]that names nothing stays prose, andhttp:-style links are not fetched. Without--checkthe same problems are warnings and the pages are written. Only the program’s own modules are checked, never a dependency’s or the library’s. Alternatives weighed: reporting every unresolved[x](prose in brackets is common:[1, 2, 3]); fetching external links (slow, flaky, and a fetch the command promises not to make); running the blocks as tests (a separate feature, left for later).
- Settled on the user’s delegation 2026-11-19: a doc comment is the run of
-
Settled on the user’s delegation 2026-11-20 (branch
mem-mir-size): the mid-level representation keeps an integer constant as a number and shares each call signature. AnOperandwas 40 bytes becauseConstIntheld its decimal text; it now holds along(ConstInt(bits, value)), and an integer nolongspells the same way (one wider than 64 bits, aBigIntliteral) isConstWide(bits, digits: &string), so the LLVM text stays byte for byte what it was. ARuntimeorIndirectcallee names a&MirSignaturethat lowering makes once per shape (MirSignatures, keyed by the signature’s types), so a call no longer carries its own two lists.Operand40 → 24 bytes,Inst136 → 88,Terminator64 → 48. Measured on marshal at -O2 with a cold cache: the lower phase’s resident memory 2.98 → 2.28 GB, its in-use heap 1.80 → 1.41 GB, the build’s peak 5.54 → 4.66 GB; the emitted module of marshal (with and without-g) and of 252 corpus programs is unchanged. The instance cache’s entry format is unchanged too: a constant is still written as its digits and a signature in full, and reading one shares it again. Alternatives weighed: signatures by index into a table onMirProgram(as small, but every pass that reads a call’s signature, emit, devirtualization, union words and the instance cache, would need the table handed to it, where a shared reference needs nothing); keeping one signature per call behind a reference (no sharing: the lists stay per call); boxing the rare large instructions (Variable,AtomicCompareSet, a C call’sCFunction): once operands shrank, the largest variants,Call,Select,AtomicCompareSetandVariable, all carry 80 bytes, andCallandSelectare common, so boxing the rare ones shrinks no instruction and was left out. -
Settled on the user’s delegation 2026-11-20 (branch
mem-clang-child): a build’s clangs and link run in a compiler image that never compiled. Onceavin build,avin runoravin testhas compiled (diagnostics already said, the instance cache already written), the compiler writes the module’s text, the shim archive, the C flags and the tests to a temporary directory and replaces itself withexecasavin --linking-handed <dir> <the same command>; the new image carries out the same command, takes the compilation from the directory where it would compile, removes it, and splits, compiles the units and links. Freed small allocations stay resident for a process’s life on macOS, so only a new image drops them: marshal at-O2, cold, peaked at 8.19 GB for the process tree before and 5.48 GB after (the compile alone; the linking image held 1.10 GB beside its 8 clangs), at the same speed. Same process id, standard streams, exit status and signals;AVIN_BUILD_LOGgoes on in the same file, withhandoffandrestorelines between the compile’s phases and the link’s. When the directory cannot be written or the image cannot be started, the link runs in place as before; a directory that cannot be read is compiled again. Only the compiler’s ownmainhands off, so a compiler run in memory (its tests) links in place. Alternatives weighed: a child that compiles and exits while the first process waits to link (what Sysl’ssysl testdoes; two processes, and every diagnostic and the live report passed across); a child for the link while the compiling process waits (its retained heap stays resident beside the clangs, so nothing is gained); returning freed memory to the system (macOS gives none back). Review with the user: the internal--linking-handedargument shows inpswhile a link runs. -
Settled on the user’s delegation 2026-11-20 (branch
gc-release): a collection gives the whole pages of large free runs back to the system (runtime), through the page release hook of gc 0.4.0, with the system’s page size (getpagesize, 16 KiB on macOS arm64).- How, on macOS: the range is mapped afresh in place (
mmapwithMAP_FIXED), as the stacks’ unused pages already are. Measured on a burst of 8 million strings (932 MB at the peak) dropped and followed by churn: the resident size the system reports (process.residentBytes, what marshal reads) stayed at 1047 MB withMADV_FREEand withMADV_FREE_REUSABLE, and fell to 2 MB with the remap.MADV_FREE_REUSABLEalso expectsMADV_FREE_REUSEbefore the pages are used again, and the collector hands a released run out again with no call to the client, so it was not sound here even had it measured well. On Linux,madvise(MADV_DONTNEED), which drops the pages at once; written, not run on this machine. - When: a collection releases only when the arena reaches more than twice the budget past what the last collection left live, and at most once a second. Without the first condition a program whose live data is small churns its 8 MiB of allocation in and out of the system at every collection; without the second, one whose live objects sit high in the arena (a buffer made after a burst) releases and refaults the free pages below them at every collection. Both were measured: unthrottled, the churn after the drop took 1.2 s more system time over 2000 collections; with both conditions the system time is the same as with releasing off. A collection that does not release runs with the hook removed, so its free runs stay ordinary blocks a later collection can release. The first release in a program is never delayed.
AVIN_GC_RELEASE=0turns it off; unset or any other value leaves it on.- Cost: binarytrees 21 at -O2, three runs each way, 7.01–7.81 s with releasing and 7.01–7.39 s without (the same within noise); the burst reproducer’s churn 9.16–9.72 s user with and 8.78–9.56 s without, system time 0.09–0.11 s both ways.
- Alternatives weighed:
MADV_FREEandMADV_FREE_REUSABLE(above); releasing at every collection (the refault cost above); a retained cushion skipped inside the hook (unsound with this gc: a range the hook skips is still marked released, and is never offered again until written); a library call to release on demand (no program needs it yet). Review with the user: whether one second is the right interval, and whether a program should be able to ask for a release (a collection) itself, since without one a program that drops a burst and then allocates little keeps its pages until enough allocation brings a collection.
- How, on macOS: the range is mapped afresh in place (
-
Settled on the user’s delegation 2026-11-23 (branch
http-request-timeout):http.servebounds the whole of a request (servers) byrequestTimeout, 60 seconds unless asked, measured from the request’s first byte and covering its line, headers and body, chunked or of a length; once spent, the next wait for bytes is answered408and the connection closed, freeing its slot amongmaxConnections. Why:readTimeoutbounds each wait alone, so a client sending a byte every few seconds held a connection, and a slot, for ever.- Each request has its own bound, begun when its first byte is read; on a connection kept
alive the idle wait before it is
idleTimeout‘s and no part of it, and a connection’s wait for its first byte staysreadTimeout‘s. A wait is cut to what is left of the bound, so the408comes at about the bound and not at the nextreadTimeout. Bytes already read ahead (pipelining) are parsed without a wait, so the bound costs a clock reading per wait only. - Zero is no limit, as for the other timeouts; a negative bound traps where the server
starts, as a negative
maxBodyBytesdoes (a negative timeout is a mistake, not a wish). - The parameter comes last, after
errors, so no call passing the earlier ones by position changes meaning. - A refusal’s drain is bounded in time too: after a refusal the server read and dropped
what the client still sent, each read waiting half a second, up to 1 MiB, so a client trickling
on after its
408kept the connection for as long as it liked. The drain now lasts half a second in all. - Alternatives weighed: a header bound alone (as some servers keep apart from a body’s) leaves a
trickled body open; a minimum data rate is harder to state and to test; 30 seconds (as
readTimeout) or 300 seconds for the default. Review with the user: whether 60 seconds suits as the default, since a slow client uploading the default largest body of 1 MiB needs about 17 KB/s, and a server taking larger bodies has to raise it; and whether a TLS handshake, whose waits are eachreadTimeout‘s, should get a total bound too.
- Each request has its own bound, begun when its first byte is read; on a connection kept
alive the idle wait before it is
-
Settled on the user’s delegation 2026-11-23 (branch
http-forms): form bodies inavin.net.http(HTTP server):ServerRequest.form()andRequest.withFormforapplication/x-www-form-urlencoded,ServerRequest.multipart(limits),Multipart.parse,Multipart.encodedandRequest.withMultipartformultipart/form-data.- One urlencoded codec,
Url.formDecodeandUrl.formEncode, whichqueryParamsnow reads through, so a query and a form body decode alike (WHATWG URL’s parser and serializer). Decoding is strict where WHATWG is lenient: a malformed%escape or bytes that are not UTF-8 are an error (BadEncoding(UrlError),400) rather than kept or replaced by U+FFFD, since a silently altered field is worse for a server than a refusal. Acharsetparameter is ignored; the body is read as UTF-8, as WHATWG reads every form. The serializer escapes~as WHATWG does, soformEncodediffers fromUrl.encodethere. - A wrong or missing
Content-Typeis an error (NotAForm,415), never an empty form.form()andmultipart()are methods with parentheses, since each parses the body anew. - Multipart is read strictly by RFC 2046 lines: CRLF only (a body of bare line feeds has no
delimiter); a delimiter followed by anything but
--or optional spaces/tabs and CRLF is body content, so binary bytes resembling the boundary stay in the part; a body without the closing delimiter isBadMultipart; a body of no parts (--b--) is an emptyMultipart. Every part needsContent-Disposition: form-datawith aname(RFC 7578 §4.2); a part’s type defaults totext/plain(§4.4). Header lines must betoken: valuein UTF-8; folded lines are refused. - Names and filenames are read as the WHATWG HTML standard writes them: a quoted value runs
to the next
", and%22,%0D,%0Abecome", CR, LF; there is no backslash escaping (browsers send Windows paths with raw backslashes). The builder writes the same way, so the round trip is exact. Aboundaryin theContent-Typeis read as an RFC 9110 parameter (quoted-pair escapes honoured) and must be 1–70bcharsnot ending in a space (NoBoundary). filename*(RFC 5987) in UTF-8 or ISO-8859-1 is preferred tofilename, as RFC 6266 prefers it; one in another charset or malformed is ignored (falling back tofilename, or no filename). RFC 7578 says senders should not use it, so the builder never writes it.- Filenames are untrusted and nothing writes them to disk:
Part.filenameis the sender’s text as given, documented so; the library offers no “save upload” helper that could use it. - Limits,
MultipartLimits(maxParts = 1000, maxHeaderBytes = 8192, maxBytes = 10485760): a part count (TooManyParts), the bytes of one part’s header block (PartHeadersTooLarge) and the whole body (FormTooLarge), each413. The body is first bounded by the server’s ownmaxBodyBytes(1 MiB by default), somaxBytesbinds only where a program raises that; it is there so a streaming reader can enforce the same limits. 1000 parts follows common server defaults for form fields and files. - Streaming is a later addition, not a change: request bodies are buffered today, so
parsetakes the whole body; a streaming reader will be a separate entry point (a reader yielding each part’s head and then its body as a stream) besideMultipart.parse, sharingMultipartLimits,FormErrorand the header and disposition readers, so nothing here changes shape when it comes. - The client:
withMultipart(form)usesMultipart.newBoundary()(avin-and 32 hex digits fromSecureRandom);withMultipart(form, boundary)andencoded(boundary)trap on a boundary RFC 2046 refuses or one a part’s body holds. Both builders replace anyContent-Typethe request had.Request.header(name)was added besideResponse.header. - Alternatives weighed: lenient urlencoded decoding as WHATWG (silent corruption); accepting LF
line ends in multipart (looser than the RFC, invites ambiguity with binary bodies); RFC 9110
backslash escapes in disposition values (mangles Windows paths browsers send); refusing a
malformed
filename*(one bad optional parameter failing a whole upload); aformreturning a plain vector likequeryParams(aFormwithvalue/valuesreads better in handlers, andpairskeeps the vector). Review with the user: the default limits, and whether aformAs[T]mirroringqueryAs[T]is wanted.
- One urlencoded codec,
-
Settled on the user’s delegation 2026-11-23 (branch
avin-log):avin.log, structured logging in the standard library (system library).- The central API: a
SendableclassLogger, reached as a given. The record functionstrace…error(message, fields)are a logger’s methods and also module functions takingusing logger: Logger = DefaultLogger; a program declares a given at its module’s top level, and a request’s handler achildas a given of its own block. There is no global logger to set: the default is a fixedval(Info, text, standard error), and configuration is a given, so no module-level mutable state exists and a test’s logger can never leak into another’s. Alternatives weighed: a given only, with no default (every library function logging would demand one of every caller); a settable global default (mutable shared state, and two configurations racing in a test run); a logger passed explicitly everywhere (what contextual parameters exist to remove). Review with the user: the central API, the name of the module functions (log.info(…)reads well, butdebuganderrorimported by name hide the prelude’sdebugof a value and read like theErrortrait), and whether a settable process-wide default is wanted after all. - Laziness by by-name parameters. The message (
-> string) and the fields (-> Vector[Field]) are by-name, so a record below the threshold evaluates neither; the threshold is oneLevelcomparison. Measured at-O2, 10 million disableddebugcalls with an interpolated message and two fields take about 17 ns each beside 0.4 ns for the bare loop, and 2.8 ns each behindif logger.enabled(Level.Debug): the difference is the two delayed arguments’ closures being made, which the by-name chapter’s representation says live on the caller’s stack where they cannot escape. Alternatives: a closure parameter() -> string(heavier to write at every call), a string built always (the cost a disabled record must not pay), a macro (the language has none). - A field is
(string, Any): any value can be written without conversion, a number and aboolkeep their kind in JSON and anything else is itsDisplay. AnOptionis not unwrapped: a type pattern cannot match anOptionof any element type held in anAny(Option[_]is refused as an open constructor), so a field not known is left out (the access log leaves out an unknown length or address). Alternatives: a union of the JSON kinds (every other value converted by hand at the call); aLogValuetrait (an impl for every type a program logs). - A logger’s own fields are rendered when it is made, in its format, and held as text, which
keeps the logger
Sendable(anAnyis not) and makes a child free per record. A key written twice, by a child and a record, is written twice rather than replaced. - Text lines: RFC 3339 time (
Instant‘s display), the upper-case level padded to five columns, the message with its control characters escaped, thenkey=valuewith a value or key quoted as a JSON string where it is empty or holds a space, a control character,",=or\. Colour paints only the level’s name, only wherecolouris asked and the sink takes it (the standard sinks: a terminal,NO_COLORunset,TERMnotdumb, throughsysl.posix.tty). - Sinks are a
SendableSink(write, colours)called once a line with its\n, so one call is one write and lines never interleave, asprintlnkeeps them. The file sink appends each line under a lock with the file opened for that line (fs.appendText), rather than holding aFileopen: an openFilebelongs to the thread that opened it and traps when another thread writes it, even inside aMutex; and reopening per line also survives a log rotator moving the file away. A line that cannot be written is dropped: logging never stops the program it reports on. Alternatives: a writer thread owning the file behind a channel (a thread to start and stop, and lines not yet written when the record’s call returns); aFilebehind aMutex(refused by the file’s thread ownership, above). - The HTTP access log gains an overload
accessLog(logger, clock, ids), writing anInforecordrequestwith its fields; the sink form is unchanged.
- The central API: a
-
File conveniences in
avin.fs(branchfs-conveniences). Settled on the user’s delegation 2026-11-23:readLines/lines/writeLines,writeTextAtomic/writeBytesAtomic, acreateParents = falseargument on every write,removeAllandremoveIfExists.- Lines end at
\nor\r\n; the last line needs no terminator; a final terminator ends the last line rather than starting an empty one (so an empty file has no lines).writeLinesalways writes\n, so a file it writes ends in a newline. lines(file)answersResult[Lines, IoError]: an open failure is immediate, a read failure mid-stream is the last item.Linesis an iterator and anio.Close. The file closes when the iterator is exhausted or fails; an early stop isclose()(defer), and a forgotten one is closed by the collector like anyFile. Alternatives weighed: closing on garbage collection alone (descriptors held for an unbounded time); a callback formwithLines(file, f)(does not compose with iterator adapters).createParentsis a default argument rather than twin functions, since the language has default arguments; the default isfalse, so existing calls are unchanged.- Atomic writes: a uniquely named file beside the target (its name from the system layer, unique
per call and per process), written,
fsynced, closed, and renamed over the target; any failure removes it and leaves the target untouched. The directory itself is not synced after the rename, and the replacement has default permissions rather than the old file’s. removeAllremoves a file, a link (never followed) or a tree, and a missing path isNotFound;removeIfExistsreturnsResult[bool, IoError](Ok(false)for nothing there) rather than a barebool, since removal can fail for other reasons and aboolwould hide them. Review with the user: whetherremoveAllof a missing path should rather succeed, asremoveDirAlldoes.
- Lines end at
-
Settled on the user’s delegation 2026-11-23 (branch
fs-walk):avin.fswalks lazily, with options (system library).walker(root, …)is anIterator[Result[Entry, IoError]], the shapeio.inputsalready has for a lazy sequence whose steps can fail; each directory is listed (whole, aslistDirsorts it) when the walk reaches it.walk(root)keeps its name, result and behaviour and takes the same named options, gatheringwalker; nothing is deprecated. Alternatives: changingwalkto answer the iterator (breaks every caller’smatchon itsResult), and a separate options value (named, defaulted parameters read as well at the call and need no new type).- Options:
maxDepth(no limit by default; 0 the root alone; negative fails at the call),includeRoot,postOrder,followLinks,prune,stopOnError.pruneis asked about each directory the walk is about to go into, never the root (a hidden or oddly named root would otherwise end a walk before it starts) and never a directory atmaxDepth(it would not be gone into anyway); a pruned directory is still an entry. - An unreadable directory: reported by default, failing on request. By default it is an entry
with the reason in
errorand the walk goes on, aswalkalways did; withstopOnErrorit is anErr, the walk’s last element. A root that cannot be listed is anErreither way. A root that is not a directory isNotADirectory(aswalkalways answered) unlessincludeRootasks for it, when it is the one entry. - Following links, a loop is found by canonical path: a link naming a directory whose
canonicalizeequals that of a directory on the walk’s own way down is an entry carryingOther("file system loop")and is not gone into;stopOnErrormakes it theErr. Only ancestors count, so two links to one directory are both walked. Device and inode would avoid arealpathper directory, butMetadatadoes not carry them yet (branchfs-metadataadds them); switching is a change insideWalkerwith no change to what a program sees. Canonical paths are asked only whenfollowLinksis on. Alternatives: a global visited set (would skip a second link to a directory outside any cycle), a dedicatedErrorKind(adds a variant every exhaustive match ofErrorKindwould have to name). Entrykeeps its fields; its kind isisDirandisLink, two calls per entry as before. Akindfield joins it whenMetadata.kindlands. A followed link to a directory has both true.find(root, p, …)answers paths (asglobdoes), and has a pattern overload matched againstrelative; it takes the options butincludeRootandpostOrder.{a,b}alternation inmatches,matcherandglob, written out before the pattern is split into components, so an alternative may hold/,**and further braces.{a}isa,{}and{,x}have the empty alternative, an unclosed{is literal, as an unclosed[is, and braces escaped or inside a class are literal. The hidden-name rule applies to each written-out pattern, so{.git,src}fits.git. Alternatives:{a}kept literal (some shells do; no pattern reads better for it), and alternation inside a component only (forbids{src,lib}/**). Review with the user: overlaps the path-helpers item, which also lists{a,b}.matcher(pattern)is a function value reading the pattern once. Alternative: aGlobclass; a function value is all a walk filter needs.
Proposed
-
Settled on the user’s delegation 2026-11-23 (branch
fs-handle):Filehas positionedreadAt/writeAt,setLength(aliastruncate),sync/syncData/fullSyncanddeleteOnClose. Positioned calls never move the position and hand over or give up what the handle buffered (written bytes are drained, read-ahead dropped), so they mix freely withreadandwrite.readAtloops untilmaxbytes or the end, so a short answer only means the end;writeAtloops over partial writes, so it writes all or answersErr.syncDataon macOS isfsync;fullSyncis the one that empties the drive’s cache.deleteOnCloseis a flag on the handle thatclosehonours by removing the name (a file the collector frees is not removed), built in Avin onremove, with no new Sysl function. Why: positioned I/O is what random-access files, stores and concurrent writers need; one handle per lightweight thread keeps the “a file belongs to the thread that opened it” rule. Alternatives weighed: aResult[long]partial write (every caller would loop); marking at open time (createTemp), which would need a new open variant. Review with the user: whether delete-on-close should instead be an open option once Sysl exposesopen_with. -
Settled on the user’s delegation 2026-11-19 (branch
train-ax): inside brackets whose commas separate items a comma after aselect‘s one-line arm ends the arm, theselectand the item, as it does a match’s, and aselecton a block’s last line that closes a bracket ends at that line’s comma. Why: the select chapter says its arms are written as a match’s are, and with the 2026-11-19 rule that a block’s last line ends at its comma the old reading (the comma list a tuple the arm yields) no longer parsed at all, failingselect_readable_custom; the rule makesf(select…-> v, x)mean whatf(m match…-> v, x)means. Alternatives: keeping the tuple reading forselectalone (one construct reading commas unlike its sibling); an error asking for parentheses either way. It changes code that compiled before:println(select…-> "up", made)printed a tuple and now passes two arguments, so that test writesprintln((select…-> "up", made)). Review with the user: it changes the meaning of code that compiled before. -
Settled on the user’s delegation 2026-11-18 (built on branch
tls-strand): a read of a wholeTlsStreamthat has to wait for input while part of a record awriteSomemade is still unsent waits for input OR room, whichever comes first, and sends that rest as room comes; its wait keeps the connection’s time limit (TimedOutwhere it runs out, the unsent rest kept in order for the next read or write).TcpStreamgainstimeout -> Duration, the limitsetTimeoutset, which that wait needs since the limit may have been set on the TCP connection before TLS began (spec system-library.md, TCP and TLS). This settles the review question of thepg-flake-0032entry below. Why: a whole connection’swriteSomethat sent part of a record left the rest for its next write,writable()or close, so a caller that ended a request withwriteSomeand then only read left its peer waiting for the rest while it waited for the peer’s answer, a hang until the time limit. The one wait cannot be for room alone, since a peer that is itself sending and not reading would then never be read from (two full connections, each end waiting to write); it cannot be for input alone, which is the hang. A select over the TCP connection’sreadable()andwritable()waits for both on the one thread that owns the connection; the runtime’s poller keeps one waiter per descriptor and direction, and an unsplit connection has only this thread, so the two watches never meet another waiter (the obstacle that ruled this out for a split connection’s reader). Alternatives weighed: a whole connection’swriteSomesending its whole record as the split writer’s now does (it would break “afterwritable()answeredtrue,writeSomedoes not wait”, which single-threaded select loops rely on, and could deadlock one thread reading and writing a busy peer); flushing the rest in full before a read waits (the same deadlock, the read waiting for room while the peer waits for room too); a flush the caller must call (every caller, a genericStreamWriterone included, would have to know it). Not covered: a program that, after awriteSomeleft a rest, waits in aselectwith only areadable()arm on the connection; a select watches one direction per arm, so such a loop keeps awritable()arm whilewritable()answersfalse, as the threads chapter’s write loop does. Review with the user: whether that select case deserves more (areadable()that also sends what room allows). -
Settled on the user’s delegation 2026-11-18 (built on branch
pg-flake-0032): the writing half of a split TLS connection sends the whole record eachwriteSomemakes before it answers, waiting for room for the rest where the connection has too little, refining the 2026-11-15writeSomeentry for that half (spec system-library.md, TLS). Why: awriteSomethat kept the rest of its record for a later call left it unsent where the writer made no later call, and its peer waited for that rest for ever. pg’s batch writer hit exactly this: its thread sends a batch with thewritable()andwriteSomeloop the threads chapter shows, then ends; when the lastwriteSomemet a full connection, the end of the batch never left, the server waited for it, and the reader waited for the server (about one TLS batch in ten under load). A split writer has a thread of its own and its reading half reads meanwhile, so waiting there cannot hold up the peer’s answers, which is the deadlock the 2026-11-15 entry avoided by never waiting. Where the writer’s time limit runs out first,writeSomestill answers the plaintext TLS took (it has been taken and will go), the rest kept to go before anything else andwritable()sending it as room comes, as before. With it, ciphertext a wait that failed did not send is kept in order rather than dropped, on both the connection and its halves (a timed-outwriteused to lose the part of a record it had begun, breaking the TLS session). Unchanged: a wholeTlsStream‘swriteSomestill never waits afterwritable(), since one thread may be both reading and writing it; its kept rest goes at the connection’s next write,writable()or close. Alternatives weighed: the reading half sending the kept rest while it waits for input (it would wait for room on the descriptor the writer’s select watches, and the runtime’s poller keeps one waiter a direction, so one of them would never be woken); a flush the caller must call after its lastwriteSome(every caller would have to know it, and a genericStreamWritercaller cannot); a low-water mark of a whole record on the socket so a record always fits afterwritable()(not settable on every system); the whole connection’swriteSomewaiting too (a single thread reading and writing a busy peer could deadlock). Its review question, whether a wholeTlsStream‘s kept rest should also go while a read waits, is settled by thetls-strandentry above: it does. -
Settled on the user’s delegation 2026-11-17 (built on branch
println-atomic):println(x)andprint(x)render all their arguments (andprintlnits new line) first, into a string, and add that to standard output in ONE write, so a line printed is never split by another thread’s output (spec system-library.md, besideeprintln‘s same promise). Found when two threads’println(99)came out9999\n\n:printlnwrote each value and then the new line as separate writes. The one write is a singlefwriteon the C stream, which holds the stream’s lock for the whole call, so another thread’s write lands before or after it and a flush sends it out whole, in order, however long it is. Rendering happens before the write, outside any lock, so a value slow or large to render holds no other thread up. Consequences: a value rendered forprintlnis now built as a string first (one allocation and copy per call; the digits ofprintln(n)no longer go out from the stack); aDisplaythat itself prints puts its own output before the line rather than inside it, and one that traps part way leaves none of the line rather than a part. Output built from several calls, or written toStandardOutputpiece by piece, is still several pieces. Alternatives weighed: hold the stream’s lock across the whole render (a slow render, or one that parks the thread or waits on a collection, would stall every printing thread, and aDisplaythat prints would deadlock); keep separate writes and promise nothing (the spec already promises whole lines for standard error, and interleaved lines from threads are the commonest complaint); a per-thread line buffer in the runtime (more machinery for the same guarantee). Review with the user: only if the extra allocation perprintlnshows up in a benchmark that prints heavily. -
Settled on the user’s delegation 2026-11-15 (built on branch
opaque-types): opaque types are spelledopaque type Name[T…] = Reprat the top level,opaquea declaration word only beforetypeand a name. Why: an opaque type reads as the alias it resembles, with one word saying the difference, and the parser and formatter treat it as an alias. Alternatives weighed:newtype Name = Repr(a new keyword for a small feature);data Name(value: Repr)with an annotation (a data value is an object, and the layout is the point);type Name = new Repr(a modifier inside the body reads as part of the type). -
Settled on the user’s delegation 2026-11-15 (built on branch
opaque-types): the representation is seen only in the declaring module, throughName(r)andx.repr(and barereprin its impls), with no implicit conversion either way even inside the module. Why: an explicit wrap and unwrap keep every crossing between the type and its representation visible in the source, which is what the type exists for, and one rule holds everywhere;repris one short name that cannot be confused with a field of the representation. Alternatives weighed: the type transparent inside its module (the module’s own code could mixUserIdandlongunnoticed, and the type checker would need two views of every type); a.valueaccessor (a common field name of representations, so it would shadow or be shadowed); an unwrapping patternName(n)(it reads as a constructor pattern of a data type, which an opaque type is not, andx.reprcovers it). Review with the user: whether the module that declares the type should see it as its representation. -
Settled on the user’s delegation 2026-11-15 (built on branch
opaque-types): an opaque type is nominal,Type.Opaque(id, name, args, repr), a value type that is boxed only where it becomes anAnyor a trait’s value, and its box names the opaque type over a reference too. Its parameters are invariant and take no bounds; a phantom parameter is allowed. The representation may not beNothing,unit, a union, a bare type parameter or name the type. Why: laid out as its representation, aVector[UserId]holds thelongs themselves and the type costs nothing; a box naming the opaque type is what letsx: Anybe matched asUserIdand never aslongorstring, so the abstraction holds throughAny. Variance would expose the representation’s own variance, which only the module sees; bounds have nothing to bound, since the representation’s types hold their own.Nothing,unit, unions and a bare parameter have no single layout to share. Alternatives weighed: reusing the representation’s box for a reference representation (cheaper, butx is _: stringwould find anEmail); covariant parameters (unsound for a mutable representation); refusing phantom parameters as an alias does (they are a main use: typed identifiers). -
Settled on the user’s delegation 2026-11-15 (built on branch
opaque-types): an opaque type is no type constructor: a generic one is refused for a constructor parameterF[_], and an opaque type declares no constructor parameter of its own; it is an ordinary type argument ofF[A]. Why: every instance of a constructor parameter’s application is laid out as an object, which an opaque type overlongis not, and a representationF[int]would leave the opaque type’s layout to each use. Refusing both is the sound position that can be loosened later. Alternatives weighed: accepting an opaque type over a reference type as a constructor (sound for the layout, but it would make the rule depend on the representation, which outside code should not see); acceptingopaque type W[F[_]](the layout question is only deferred, to every use). -
Settled on the user’s delegation 2026-11-15 (built on branch
opaque-types): a refined variant’s result does not name an opaque type (Newest -> Query[UserId],Query[Id[User]],Query[Vector[UserId]]are refused); a variant’s fields may be of opaque types and the type’s own argument may be one. Why: amatchon a refined variant will learn type equalities from the result, and whether one learningR = UserIdshould see the representation inside the opaque type’s module is not decided; keeping opaque types out of results is sound and can be loosened once matching on refined variants is built. Alternatives weighed: accepting them as nominal types now (sound for values and layouts, but it fixes the answer to the open question before the matching it affects exists). -
Settled on the user’s delegation 2026-11-15 (built on branch
opaque-types): equality and hashing are the representation’s; every other trait comes from an impl, which takes the trait’s default bodies; an opaque type derives nothing and has no supertype. Why: every Avin type has==and a hash, so an opaque type is aMapkey and aSetelement without ceremony, while order and printing are choices the module makes for its type (anEmailmay print as<…>, aUserIdmay have no order). Default bodies run on the boxed value, socomparegives<,less,maxand sorting. Alternatives weighed:derives Ord, Displayforwarding to the representation (convenient, but it would show the representation’s text and order outside the module by default); inheriting every trait of the representation (the opaque type would leak its representation’s whole interface). -
Settled on the user’s delegation 2026-11-15 (branch
dwarf):-gis asked for, never implied, and onlybuildandemit-llvmtake it. Not even-O0turns it on. Why: a-gbuild is slower and larger (every unit carries the metadata, function text is never cached, macOS runsdsymutil), andrun/testexecutables live in the cache where no one points a debugger; a flag keeps every existing build exactly as it was. Alternatives:-O0implying-g(the usual “debug build”; costs every-O0corpus and test build),run -g/test -g(useful for a test under lldb, but the cached executable is not where a user expects it; easy to add later). Review with the user: whether-O0should mean “debug build”. -
Settled on the user’s delegation 2026-11-15 (branch
dwarf): what the debugger is told. Functions are named by their symbols (<program>.fact,<program>.twice[int],<program>.main.lambda#1) as the linkage name, with the program’s own module prefix left off the readable name; lldb shows the linkage name. The compile unit saysDW_LANG_C, so lldb reads the basic types in its own words (double,char32_t).charis a UTF-32 code point,byteunsigned,boola byte; a reference is a pointer to an opaque structure named by its Avin type. A local a lambda shares (boxed) is not described, nor is a local the compiler made. DWARF version 4. Why: each is the smallest choice that makesb,btandframe variablework with no lldb plugin. Alternatives: a vendor language code (lldb then treats frames as unknown language), describing objects’ fields as DWARF structures (a larger item: layouts per descriptor, unions, generics), showing strings as text (needs an lldb data formatter shipped with avin), describing boxed locals throughDW_OP_deref(small, later). -
Settled on the user’s delegation 2026-11-15 (branch
dwarf): the code taking parameters in has no line, so lldb’s breakpoint at a function’s first line lands after the parameters are stored where their variables are read (a lambda’s parameter otherwise read a stale slot). A call there still gets the function’s own location, which LLVM’s verifier asks of every call in a function with debug information. Alternative: placing that code at the function’s name, as it was first built: lldb then stopped before the stores and showed the slot’s previous value. -
Settled on the user’s delegation 2026-11-15 (branch
dwarf): a-gbuild never reads or writes function text in the instance cache, and keeps its lowered code apart (program-O2-g); eachLocatein a cached entry is kept counted from its declaration’s start, as trap sites are. Why: metadata is numbered across the module and locations follow lines no function key covers, so cached text would carry stale lines; the lowered code is still reused, andAVIN_INCREMENTAL=verifymatches a clean build. Alternatives: per-function metadata numbering with a renumbering pass (the text cache would then work under-g), or a key over absolute positions (every edit above a function would relower it). -
Settled on the user’s delegation 2026-11-15 (branch
dwarf): codegen units carry all of the module’s debug metadata, as every other module-level line, so any line moved anywhere changes every unit’s text and recompiles every unit of a-gbuild. Plan to do better when it matters: the splitter follows!Nreferences from each unit’s definitions through the metadata lines and renders only the nodes reached (plus the compile unit and the flags), which also shrinks each unit. -
Settled on the user’s delegation 2026-11-15 (branch
dwarf): the stack overflow report stays without a place. The handler runs on its own stack inside a signal, where reading DWARF (or runningatos, a process) is not safe, and a build without-ghas no line table at all. Plan: in a-gbuild the handler writes the faulting program counter and the image’s load address (avin: trap: stack overflow at pc 0x… (image 0x…)), andavin(or a user withatos -o prog.dSYM -l <image> <pc>) turns it intofile:lineafter the process has stopped; a table of function start addresses with their names, emitted as a constant, would let the handler name the function itself, without lines, at any-glevel. Neither is built: the first needs a runtime change and a symbolizing step, the second a table the emitter does not make yet. -
A package’s tests import its gated modules; a test module is read only while every module it imports is (packages; branch
gated-tests). The tests were fenced as an always-compiled module, so a test of a gated module had to live inside that module, and atestsfile importing it was refused even underavin test, which turns every feature on. Nowtestsand the modules under it have no fences: they may import every module of the package and its optional dependencies. A build with a feature off passes over each test module importing a module that is off, and, repeated to the end, each test module importing one passed over; the rest are read and run. The module stays the unit, so a file oftestsimporting a gated module takes all oftestswith it when that feature is off. Why: the spec already saysavin testhas every feature on, so the tests see the whole package; and the package’s owntestsare compiled bybuildandruntoo, so a selection-independent refusal was the only thing keeping a build with features off working; deriving each test module’s gate from its imports keeps that guarantee with no annotation to write. Alternatives: allowingteststo import gated modules only underavin test(a build oravin test --no-default-featureswould then fail at the import, so the minimal configuration could not be tested); letting a feature listtests.serverexplicitly (works, but repeats in the manifest what the imports already say); skipping single files rather than modules (finer, but a file oftestscould then lose a helper another file of it uses, breaking only the build with the feature off). Not covered: a test importing an optional dependency’s module directly while that dependency is not taken is reported as an unknown module, since a dependency not taken is not read and its modules are unknown; such a test reaches the dependency through the package’s gated module. Review with the user: whether a test module passed over should be named inavin test‘s output rather than silently absent. -
An import refused for its module is one error per import declaration, not one per name it imports (branch
gated-tests):import a.b.{c, d}refused as gated, as an optional dependency’s, or as a standard-library module that does not exist, is reported once, at the first name; two import lines are two errors. Why: the error is about the module, which the declaration names once. Alternatives: one per module per file (hides the second line’s error). -
Settled on the user’s delegation 2026-11-15 (built on branch
intersection-bounds): several bounds on one type parameter are joined with&, the one spelling, and an intersection is a bound only, never a type.[T: Ord & Display]replaces[T: Ord + Display]everywhere type parameters are declared (functions, methods, classes, data types, traits, actors, impl headers, after a lower bound);+between bounds is a parse error that says to write&, and the library, tests and docs are rewritten. Each operand is a trait or a class, at most one a class (a second class is an error naming both, a subclass of the first included), and each written once (the same trait at the same type arguments twice is an error;Make[int] & Make[long]are two). Name clashes: methods of one name from two bounds are overloads, resolved by parameter types; two of the same parameter types are not an error to declare, only a call both accept is, as the existing ambiguous-call error at the generic definition.A & Bis not a type: written as a parameter’s, a field’s, aval‘s, a result’s, a type argument’s or a lower bound’s type it is a parse error that shows[T: A & B](x: T)instead. Why:&reads as “and”, which is what conformance to every bound means, and makes the bound read as the intersection it is, where+reads as arithmetic and was the only use of+in a type; one spelling, since two ways to write one thing is the kind of choice the language avoids. Bounds only, because a type parameter already gives a value of two traits everything an intersection type would, with each instance calling its type argument’s methods directly; an intersection type would need a new value representation (a pair of method tables, or a table per combination), subtyping rules against unions and variance, and reification foris— a large addition the language’s programs have not asked for, and a nominal type system with declared traits covers it by declaring a trait that requires both (trait Shown: Named, Sized). At most one class, because a class extends one superclass, so two unrelated classes can never both be met and a subclass already implies its superclass. Alternatives weighed: keeping+(the existing spelling, no source change, but reads as addition, and the user asked for&); accepting both (two spellings of one thing); intersection types in annotations, withA & B <: A, commutativity, distribution over unions and a dual-table layout (left out for the reasons above; this decision leaves room to add it, sinceA & Bin a type position is an error today, not something else); allowing redundant bounds silently (a repeated bound is always a slip). Review with the user: whetherA & Bshould become a type in annotations later, and whether to keep the+diagnostic once existing code has moved (it costs nothing and helps code written before the change). Packages outside this repository that still write+(thejsonpackage’s tests) move to&with the release that carries this.
Byte offsets inside a character (types, branch fix-charat-boundary)
- Settled on the user’s delegation 2026-11-15:
charAtat an offset inside a character’s encoding traps,charAt offset is not a character boundary, as slicing there does; the searches never trap on such an offset and never answer one.indexOf(p, from)andindexWhere(f, from)from inside a character start at the next one, so"café".indexOf("", 4)is 5;lastIndexOf(p, end)andlastIndexWhere(f, end)from inside one search back from the character it belongs to, so"café".lastIndexOf("", 4)is 3; andstartsWith("", at)is false inside a character, since the empty string occurs only where a character begins or at the end. Why:charAtandsliceread the text at the offset given, so an offset that is not a place in the text is the caller’s mistake, the trap the spec gives slicing; a search is asked “where at or after (before) this”, which has an exact answer from any offset, and answering only offsets where a character begins means every result can be fed tocharAtorsliceagain. The cost on a character boundary is one comparison on a lead byte, none on ASCII. Alternatives weighed: trapping in the searches too (a search fromi + 1over text with characters beyond ASCII would then trap where the same search over ASCII succeeds); answering the offset itself for an empty needle, as before (a result that traps when sliced at).
Initialization (declarations, branch init-design)
-
Settled on the user’s delegation 2026-11-15 (built on branch
deadlock-dump): A deadlock of the whole program is a trap; a partial one is not found (diagnostics). The main thread checks when it begins a wait with no limit, and again each time a worker finds no lightweight thread running or ready while it waits: the program is deadlocked where no lightweight thread is running or ready, no timer is set, no thread waits on a socket, no thread the program did not start is attached and no@threadedcallback is held. Every wake goes through one counter, so a check whose count did not move between its first look and its last saw one moment of the program and cannot report a thread that ran meanwhile. The report isavin: trap: deadlock: all threads are waitingand a line per thread, the trap’s exit status, and the exit hooks run after it as after any trap. Why: it is the case a program can never leave, it costs nothing untilmainwaits (one counter increment per wake, one clock read per wait for the dump), and a check made only frommain‘s own wait needs no thread of its own. Alternatives weighed: a monitor that looks periodically (a thread or a tick for every program, and latency); finding cycles of lock holders (catches partial deadlocks, but needs owner tracking on every lock and misses channels and conditions, which have no owner); reporting a held@threadedcallback or an attached foreign thread as deadlocked too (a C thread may call back at any time, so that would be a false report). Review with the user: whether a partial deadlock, found by cycles among lock holders and joins, is wanted later. -
Settled on the user’s delegation 2026-11-15 (branch
deadlock-dump): What a thread waits on is named by the runtime’s own queue: a lock, a condition, a join, a sleep, a socket; a condition the library makes for a channel’s receive or send, a future or an executor’s work says so, through the intrinsiccondition_new_kind, whichCondition‘s constructor reaches with a second parameter the library alone can pass (aConditionneeds the library’s privateLock). A channel’s own lock is “a lock”. Threads are numbered from 1 in the order they started, not by their identity. A pool’s idle workers are left out of the deadlock report, whose length would otherwise follow the machine’s processors, and listed in the dump. Alternatives weighed: a label set around each wait by the library (a call on every wait); naming waits only by the runtime primitive (“a condition” for every channel and future, which says little). -
Settled on the user’s delegation 2026-11-15 (branch
deadlock-dump): The quit signal writes a thread dump and the program goes on. A handler in C writes a byte to a pipe; a thread started with the program, with every signal blocked, reads it and writes the dump, since a handler may not take the scheduler’s locks. A program that watches the signal hears it instead; one started with it ignored keeps it ignored. Why: the program under inspection keeps running, which is what a dump is for. Alternatives weighed: writing the dump from the handler (not safe there); starting the thread only on first use (a handler cannot start one); ending the program after the dump (loses the program being looked at). Cost: one thread and one pipe for every program. -
Settled on the user’s delegation 2026-11-15 (branch
deadlock-dump): A thread dump names no functions. A frame of the shadow stack holds its previous frame and its count of slots, nothing naming its function, and walking the native stack would need a table from code addresses to Avin names, which the compiler does not emit (the stack-overflow trap has no place for the same reason). Alternatives weighed: a function’s descriptor stored in each frame (a store on every call); emitting an address table and unwinding the native stack (a table per program and an unwinder for each platform). Review with the user: which of the two, if a stack in the dump is wanted. -
Settled on the user’s delegation 2026-11-15 (branch
deadlock-dump): A corpus program’s// stderr: times varyshows every number beforemsin its standard error asn, so a thread dump’s durations do not make the test depend on the machine. Alternative: a dump without durations (loses what a dump is for). -
CPU time is read from the kernel’s accounting:
getrusageandwait4(branchcpu-time, CPU time).CpuTime(user: Duration, system: Duration)withtotalandAdd;process.cpuTime()andprocess.childrenCpuTime()(RUSAGE_SELF,RUSAGE_CHILDREN) answer it plainly, not in aResult, sincegetrusagefails only for awhoit does not know;waitPidCpu/tryWaitPidCpubesidewaitPid/tryWaitPid; andChild.cpuTime(), a pipeline’s stages and a sequence’s parts added. Why: a job manager that samples its jobs withpscannot see the CPU of sub-processes that have already exited, and the kernel folds each reaped process’s time into its parent’s, so a wait that reads it gives a whole tree’s. Alternatives weighed: changingwaitPidto answer the pair (breaks every caller; a return type cannot be overloaded); aProcessUsagerecord with the otherrusagecounters (peak memory, faults, context switches — memory is in different units per platform, and nothing asks for them yet, so they can join later without breakingCpuTime);Child.cpuTime()as anOptionempty before the wait (a running command’s reaped parts would then be invisible, and “nothing reaped yet” is alreadyZero). Review with the user: the nameswaitPidCpu/tryWaitPidCpu. -
A started program is reaped by the library with
wait4, not by its SyslSpawned(branchcpu-time). Sysl’sSpawned.waitandtry_waitreap withwaitpidand drop the usage, so the runtime (runtime/avin/rt/cpu.sysl) reaps the program itself and theSpawnedis then let go of withdetach. A time limit is kept by the library in consequence, as Sysl kept it: polled with a backoff to 16 ms up to the deadline, then signal 15, a 200 ms grace, signal 9, and a final wait, the statusTimedOutwith the CPU time it used. Why: the alternative that keeps Sysl as the reaper, readingRUSAGE_CHILDRENbefore and after a wait, is wrong whenever two threads reap at once, which a job manager’s do. Alternatives weighed: asking Sysl for awaitthat answers usage (the better home; reported to the sysl session as a gap, and this binding moves to it when it exists); reaping through Sysl and leavingcpuTime()empty for commands (no answer to the item). Review with the user: two reapers of one kind in the stack until Sysl grows the call. -
Initialization is proved at compile time, by order and by withholding
self(branchinit-design, Initialization). No field, module-level value orlazy valis read before it is set: an object’s fields are set in the order written andselfis withheld from everything that could read one later until the last is set; module values are computed in the order their initializers’ reach requires, a cycle an error; alazy valis the explicit opt-out, its own cycles an error where its code reaches them, a trap only through a function it hands on. Why: it is sound with no annotation and no cost per read, it keeps the rules Avin already enforces (every probe of them held), and each rule’s proof is a short argument a reader can check. Alternatives weighed: a checker of object states (an object cold, then warm, then hot, a parameter or a method declared to accept a cold object) accepts more, such as passing a half-made object to a helper that only stores it, but needs those annotations and a far larger analysis, and the code it would admit is rare; a default value in every field before its initializer (a wrong value read silently, and Avin has no value every type can hold); a check on every field read (a cost on every read, and a trap where an error was possible); ordering modules by their imports (an import cycle would be an error, or the order a guess); making every module value lazy (a gate on every read, and cycles found only when they run). -
A superclass’s arguments use nothing of the object, functions made there included (branch
init-design). A lambda, an argument passed by name, a local function or a method value in them that uses a field, a method orselfis an error; class parameters and module values are read freely. Why: avin 0.0.21 lets such a function through, and a superclass calling it in its body reads a field before it is set:0for a number, a crash for a string, a vector or a generic field (a soundness hole, the build plan’s first item). Alternatives weighed: allowing a function that reads only inherited fields of a class whose constructor finished before (it needs the superclass chain’s timing at each read, for code no library or example writes); a mark on a parameter the constructor may call during construction (an annotation for a rare shape). -
An object’s own name in its body is
self(branchinit-design).O.kobeys the rulekdoes; in a method, a lambda made after the last field or a lazy initializer, it makes the object need nothing more. Why: today the name counts as the module value, so a lazy field or a late lambda naming its own object is refused as a cycle while the bare name is accepted, a false error with no unsoundness behind it. Alternatives weighed: keeping the refusal (sound, but the two spellings of one read disagree); counting only code the body runs (the same result, reached by the module order rather than by the object rules, which then speak of the name twice). -
A
lazy valcycle its own code reaches is a compile error; a read through a handed-on function traps (branchinit-design). The reach is the module order’s (calls, every implementation a dispatched call or an operator may reach, other lazy values’ initializers), without the lambdas, by-name arguments and method values the initializer makes; for a field, only reads of the same object (bare name,self., methods called onself) count. Why: a cycle the code always makes is found where it is written rather than when it runs, while a value referring to itself through a function it hands on (lazy val ones = LazyList.cons(1, ones), a handler naming its button) is the reasonlazyexists and stays legal; a reach that followed handed-on functions would refuse those, and one through another instance’s field would refuse recursion over a structure (a node’s depth). Alternatives weighed: the trap alone (today’s: a cycle anyone could see waits for a run to reach it); following every function value to every lambda of its type in the program (sound without a trap, but it refuses the knots and the handlers). Review with the user: through dispatch the reach counts every override, so a lazy value calling a trait method one of whose implementations reads the value is refused even where that implementation never runs, as module values already are. -
Settled on the user’s delegation 2026-11-14 (branch
init-3): the module-level part of thelazy valrule, and making a lazy field needs nothing.Useskeeps the functions code calls (with every implementation a call through a method table or an operator may reach, and the initializers of the lazy values it reads) apart from those it makes; the lazy reach follows only the first, stopping at another module-level lazy value’s initializer and naming that value, so the error isthe `lazy val` `first` needs its own value to initialize: `first` → `second` → `first`, a value on its own as`l` → `l`, reported from the chain’s earliest-declared member, and a value that only reaches a chain is not named. The module order still follows both, except alazy valfield’s initializer where a constructor makes it: only a read of the field runs it, and every read is a call of it, which the order follows. Why: it follows from the chapter (the order needs what the body runs while the object is made), and it removes a false cycle — two objects whose lazy fields read each other, or a module value holding an object whose lazy field reads that value, were refused. Alternatives weighed: the self-cycle worded as the module order’s (is needed by its own initializer), which would give one rule two shapes of message; dropping every made function from the order (unsound: a lambda the initializer makes and calls reads what it reads). -
Settled on the user’s delegation 2026-11-14 (branch
init-4): the field and local parts of thelazy valrule. A field’s initializer is followed with the object located where its code holds it: the class body’sselfit captures, a local given it (val me = self), the parameter a called function or method receives it in, and, for an object, every read through the object’s name anywhere in the program. A call through a method table on the object reaches the override of every class descending from the one declaring the field; an operator applied to it, the core trait method of those classes; a local function, the object where its caller sees it. A read of the same field of the object is a node of the chain, a read of another instance’s is not followed, and the chain, worded and placed as the module-level one, names lazy fields only. A locallazy valis followed through its block’s code and the local functions it calls, the other local lazy values it reads being the chain’s nodes. A cycle through a module-level lazy value that reads an object’s field is the module-level value’s cycle as well and is reported for both. Why: it follows from the chapter’s “only a read of the same object counts”, which a function givenselfor a read through an object’s one name is as much as a method called onself; anything less leaves the same cycle to the run-time trap by a change of spelling. Alternatives weighed: only bare names,self.and methods called onself(the chapter’s examples, buthelper(self)would then trap at run time); following every value of the object’s class (it would refuse the recursion over a structure, a node’s depth, that the chapter keeps legal). -
A lazy initializer waiting for a thread that reads the same value is not detected (branch
init-design). It waits for ever, as threads waiting for one another do (threads). Why: Avin detects no deadlock but a lock taken twice, and a cycle through two lazy values’ own code is now a compile error, which leaves only a read through a function handed to the other thread. Alternative weighed: the runtime following a waiting read through the initializing thread’s own wait (ajoin, another lazy value) and trapping when the chain returns to the reader, cheap on the slow path. Review with the user: it is liveness, not soundness, but it is the one way a lazy read can still hang.
The security primitives an API server needs (branch security; avin.encoding, avin.crypto, avin.random)
- Settled on the user’s delegation 2026-11-15: a new module
avin.encodingholds hexadecimal, base64 and base64url (toHex,fromHex,toBase64,fromBase64,toBase64Url,fromBase64Url,DecodeError), andtoHexmoved there fromavin.crypto, which keeps offering it withexport avin.encoding.toHex, soimport avin.crypto.toHexstill works. Why: base64 is not cryptography (data URLs, Basic authentication, binary in JSON all use it), and hexadecimal in one module and its decoder in another would split one encoding. Alternatives weighed: everything inavin.crypto(one import for a server, but a module named for secrets would hold plain encodings);fromHexbesidetoHexinavin.cryptoand base64 alone inavin.encoding(hexadecimal split across two modules). - Settled on the user’s delegation 2026-11-15: decoding is strict, one function per alphabet:
fromBase64takes only the standard alphabet with its=padding,fromBase64Urlonly the URL-safe one with no=; whitespace and line breaks are refused, and so is a last digit whose unused bits are not zero (RFC 4648 §3.5 allows a decoder to refuse it). Each byte sequence then has exactly one spelling, so a token or a signature cannot be sent in a second form that compares unequal as text but decodes equal.fromHextakes either case (a digit’s case carries no bits). Errors are checked in order: characters, then padding, then length, then unused bits, so the first offset named is the first character wrong. Why: the module exists for an API server reading untrusted text, where malleability is a defect. Alternatives weighed: Sysl’s forgiving decoder (either alphabet, optional padding, unused bits ignored), which is friendlier to sloppy writers but accepts many spellings of one value; alenientflag (two behaviours to test and document for no current need). Review with the user: a reader of MIME-wrapped base64 must strip its line breaks first. - Settled on the user’s delegation 2026-11-15:
DecodeErrorhas four cases,BadCharacter(at),BadPadding(at),Truncated(at)(whereatis the text’s length) andUnusedBits(at), all byte offsets, and is anError. Why: the cases are what a caller would report differently, asUrlError‘s are;Truncatedcarries the length so every case has a position. Alternative weighed: binding Sysl’sDecodeError, whoseBadLengthhas no position and whoseShortandUtf8cannot occur here. - Settled on the user’s delegation 2026-11-15: the encoders are written in Avin, while the digests stay bound to Sysl. Why:
Avin’s decoder is stricter than Sysl’s (above), and encoding is a few lines of byte arithmetic with
no platform behind it. Alternative weighed: binding
sysl.encoding‘s encoders and writing only the checks in Avin (two passes over the text, and a second implementation of the alphabet anyway). - Settled on the user’s delegation 2026-11-23:
avin.encodinggains base32 (RFC 4648 alphabetA–Z,2–7):toBase32(padded with=to a multiple of eight),toBase32Unpadded,toBase32Lower(lower case, no padding), each over aVector[byte]or astring, and onefromBase32. The decoder reads either case (also mixed) and padded or unpadded text, because a digit’s case and a trailing=carry no bits; it stays strict otherwise, with the sameDecodeErrorcases and check order as base64: a padded text needs the right count of=(Truncatedwhen the length is not a multiple of eight,BadPaddingfor a misplaced=or more than six), an unpadded one must end on 0, 2, 4, 5 or 7 digits past a multiple of eight (Truncatedotherwise), and a last digit with unused bits set isUnusedBits. Why: marshal writes a 128-bit token as 26 lower-case characters (toBase32Lower), and a token read back from a case-folding source (a URL host, a file name) must still decode. Alternatives weighed: an options argument or default arguments for case and padding (the base64 family has one function per spelling, andfromBase64Urlshows the unpadded form as its own name); four encoders (padded lower case has no user); a decoder strict about case (a token typed or lower-cased in transit would fail for no gain in uniqueness a caller relies on). Review with the user: base32 decoding is therefore not one-spelling-per-value as base64’s is (case and padding vary). - Settled on the user’s delegation 2026-11-15:
constantTimeEquals(a, b)inavin.crypto, forVector[byte]and forstring(compared as UTF-8 bytes, so"é"and"e\u{301}"differ), bound to Sysl’ssysl.crypto.verify, which reads every byte and branches only on the lengths. Why: Sysl pins that function’s branch-free code with its own codegen tests, which an Avin loop would not have; different lengths answeringfalseat once leaks only a length, which a token’s or a tag’s is not secret. Alternatives weighed: an Avin loop accumulatingxors (its constant time would rest on the optimizer); a method onVector[byte](a security property should be found where the secrets are). - Settled on the user’s delegation 2026-11-15:
SecureRandom, an object inavin.random, withRandom‘s drawing methods (nextBytes,nextInt,nextLong, both bounded,betweenforintandlong,nextReal,nextBoolean,alphanumeric,shuffle,choose) and two token functions,hexToken(byteCount = 32)andurlToken(byteCount = 32). Every draw readsgetentropythrough Sysl’ssysl.posix.rand.entropy_from_os, which is on macOS, glibc Linux and the BSDs and loops past the 256-byte request limit. A refusal from the operating system traps. Why: one name besideRandomis found by whoever reads that module’s warning; an object, not a class, because there is no seed and no state; trapping because a program wanting key material has no safe fallback. 32 bytes is 256 bits, past any guessing.nextGaussian,chooseWeightedandsetSeedare left out: no secret is drawn from a normal or weighted distribution, and there is no seed. Alternatives weighed: a classSecureRandom()sharing a trait withRandom(an instance holds nothing, and the trait would add a dispatch to every PCG draw); a buffered pool of entropy (fewer system calls, but secret bytes kept in the heap and a lock);secureBytesand token functions inavin.crypto(randomness split across two modules);Resultinstead of a trap (a caller ofnextIntwould match on every draw).
Refined variants (chapter, branch gadt-design; designed, not built)
-
Spelling: a variant’s result after
->, its own type parameters after its name.IntLit(value: int) -> Expr[int],Balance -> Query[long],Pair[A, B](…) -> Expr[(A, B)]; the data type’s parameter names are every variant’s parameters, so a variant with no result keeps meaning-> D[T…]. Why: a variant is a constructor, and(fields) -> Typeis exactly how Avin writes a function’s signature, so the line reads as the constructor it declares; nothing else is written after a variant’s fields. Alternatives weighed:IntLit(value: int): Expr[int](:already types each field on the same line and begins an inheritance list, which a variant is not); awhere T = intclause (names the equality instead of the instance, and needs a second syntax for hidden parameters); a separate keyword per refined variant (a second kind of variant where there is one with an optional result). -
A variant fixes only invariant parameters. Where the type’s parameter is
+Tor-T, a variant’s result hasTthere. Why: an invariant argument is exact, so the equality an arm learns is true; a covariant one is an upper bound, and taking it as an equality is unsound (the chapter’sasDogmakes a cat aDog). Alternatives weighed: refining a covariant place by a bound (Dog <: T) and a contravariant one by the opposite bound (sound, but it gives one-directional facts that are hard to read in an error, and no motivating example needs it); forbidding variance on any type with a refined variant (needlessly strict: unfixed places keep their variance soundly). Review with the user: whether bound refinement at variance places is wanted later. -
Hidden type parameters are allowed, and compiled per pack. A variant parameter its result does not name is a fresh type in each arm, never leaving it; each list of hidden types the program makes a variant with has its own descriptor, and an arm on it is compiled once per pack and selected by the descriptor. Why: a typed protocol (a request and its reply address agreeing on a type the message type does not mention) and a chained plan (
Then[Mid]) need one, and the whole-program compiler already knows every pack, as it knows every implementer of a trait for dynamic generic methods, so nothing is boxed and the value-type fields stay unboxed. Alternatives weighed: refusing hidden parameters (the protocol could then only eraseRbehind a trait, losing the type the design exists to keep); boxing a hidden field behindAny(a run-time test where none is needed). Review with the user: code size, since an arm is copied per pack. -
Equalities hold exactly where the pattern’s names are in scope, and nowhere outside. An arm’s result is checked against the expected type under them; with none expected, arms yield their types as written; an inference variable settled in an arm settles to the type as written; a hidden type in an arm’s result is an error. Why: a fact true only in the arm cannot leak to code that runs without it, and “as written” is the one reading that does not guess whether an
intwas meant asT. Alternatives weighed: mapping an arm’s type back through its equalities (ambiguous:intandTare one type there and two outside); inferring the result type of a refiningmatch(needs a search the local inference does not do). -
Only variants refine. Extractors and type patterns learn no equalities. Why: an extractor’s answer type is its signature’s; a type pattern’s could refine an invariant generic’s arguments by the same header argument, but it widens the feature to every generic type and every type test. Alternative weighed: refining by type patterns on invariant instances (sound; deferred). Review with the user.
-
A union in a result names no variant parameter, since a value would not say which member a parameter is; closed unions (
-> Expr[int | string]) are allowed. Alternative weighed: deciding the parameter by normal-form order (arbitrary, and wrong for a value made at another member). -
An arm no value can reach because its equalities contradict is an error, as every unreachable arm is, and coverage counts only the variants possible at the matched type, carrying each row’s equalities; a
matchon an instance with no possible variant is an error. Alternatives weighed: a warning for an impossible arm (Avin has no warnings for unreachable code); pruning per column without carrying equalities along a row (simpler, but demands arms for combinations no value has). -
Bounds on a variant’s parameters are checked where a value is made and held in the arm, and an enclosing type parameter equated with a bounded one gains the bound there; a copy at a type without the bound compiles no such arm. Why: it is what makes a hidden type useful (
Sendablefor a reply,Ordfor a sorted payload), and it costs one more test when an arm is decided at a copy. Alternative weighed: no bounds on variant parameters (the protocol could not nameActorRef[R], whose parameter is bounded bySendable). -
The nested-data-type rule is measured against the variant’s result, and a larger part made of a hidden parameter is allowed, since its instances exist only where the program makes a pack. Alternative weighed: measuring against the plain instance
D[T…](refusesFirst[A, B](pair: Expr[(A, B)]) -> Expr[A], which has finitely many copies). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-1, the declaration step): a refined variant’s parameters, the type’s included, are the variant’s own in the expansion check. An instance reaches them through the result (Expr[X]holding aPairhasX = (A, B), soAandBlie one level down), and a type argument of a field that names a hidden parameter adds no edge, since its instances are the packs the program makes, which step 5’s check of growing packs counts. A growing cycle through a refined variant names the field and the result it is measured against. Why: it is rule 6 exactly, and it reuses the one polymorphic-recursion check rather than a second one for variants. Alternatives weighed: a separate syntactic comparison of each field with the result (misses growth through a second type, which the flow check already follows). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-1): a variant’s own type parameter takes bounds and no variance and no lower bound, and a name reused from the type’s parameters or twice among the variant’s own is an error. Why: a variant is a constructor, a generic function, whose parameters take no variance; a lower bound asks of a call’s argument something amatchcould not hand back. Alternatives weighed: allowing>:(sound at the call, but it gives the arm a one-directional fact, the kind Variance declines). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-1): a result written as the type at its own parameters,If(…) -> Expr[T], with no parameters of the variant’s own, is a plain variant, the same declaration as one with no result. A data parameter a refined variant’s result does not name is hidden there like any other (IntLit(value: T) -> Expr[int]hidesT). Why: the chapter says the type’s names are every variant’s parameters, and a written-out plain result changes nothing a value carries. Alternative weighed: treating any written result as refined (a type would lose its plain uses for a redundant spelling). -
Settled on the user’s delegation 2026-11-15 (built on branches
gadt-1andgadt-2): a type with refined variants is named, made and matched like any other, and the code the derived templates write (Display,Debug,Ord, anywalk) matches every variant, its copies compiled only for the variants possible at each instance, each arm at the arguments it reads back from the instance. The declaration step (gadt-1) and the values-and-layouts step (gadt-2) first refused the type’s uses with “yet” messages; patterns and field reads came withgadt-3, hidden parameters withgadt-5and bounded parameters withgadt-6(the entries below). Why: lowering lays out every variant at every instance, so the derived code needs only what lowering knows at a copy. Alternatives weighed: accepting patterns on plain variants before coverage over the possible variants existed (it would demand arms for impossible variants thatgadt-4then made errors). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-2): a parameter of the data type that a refined variant names in neither its fields nor its result is fixed in its signature (toNothing, which nothing observes), so it is never inferred and never written:Pair[int, bool](…)writesPair‘sAandB,Done[S]ofDone -> Plan[From, From]writesFrom, andIntLit[int](1)takes no type argument. On the type,Expr[(int, bool)].Pair(…)names the instance the value makes: the variant’s parameters are inferred from it and the value is held to it. Why: the chapter says a variant is called as a generic function, and such a parameter is no parameter of that function; leaving it to inference would make every call ofIntLitan unsolvable “cannot inferT“. Alternatives weighed: dropping the parameter from the variant’s list (its field defaults are functions of the whole list); readingT[A].Vas written arguments ofV(they are the type’s, and need not matchV‘s own in number or meaning). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-2): a derived trait holds of a refined variant’s own parameter where the trait on the instance implies it: the parameter sits in the result under constructors whose trait needs their argument’s (a tuple’s,Vector‘s), tested by whether the constructor at the parameter has the trait where every other argument does and the parameter alone has none. Where it is not implied (Hold[A](x: A) -> Odd[Wrap[A]], withWrapshowing itself whateverAis), the field falls short and the type has no automaticDisplay, as any type with such a field. A hidden parameter is decided per pack, by the parameter’s bounds (step 5, branchgadt-5, the entry below). Review with the user: whether a refined type’sDisplayshould rather be decided per instance, at the instance’s own arguments. Why: a derived impl is checked once, over its type’s parameters, and this is the most that check can know of a variant’s own; it is sound, since the trait at an instance gives it to the parameter read back there. Alternatives weighed: no trait for own parameters (every type withPairwould loseDisplay); the trait unconditionally (unsound forOdd). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-2, where refined variants meet higher-kinded types): a variant’s own type parameters are types, and a constructor parameter of the type keeps its place in a result:V[G[_]](…)is refused with"a variant's own type parameters stand for types, not type constructors: `G` of `V` takes type arguments; declare a constructor parameter on the type, as in `data D[G[_]]`", andW(…) -> D[Vector, T]with"a variant fixes no constructor parameter: `W` makes `D[Vector, T]`, and `F` of `D` is a constructor parameter, so its place holds `F`", whileY(x: F[int]) -> D[F, int], keepingFand fixingT, is accepted (step 1 refused it as “no type amatchcan take apart”, which was a mistake). Why: thegadt-1entry below settles that no constructor parameter is fixed, and keeping one in its place fixes nothing. Alternatives weighed: refusing any refined variant of a type with a constructor parameter (needlessly narrow). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-1), for constructor parameters (higher-kinded types), the conservative reading: a variant fixes no constructor parameter of its type, its own type parameters are no constructor parameters, and a result’s argument never applies a constructor parameter (-> D[F, F[A]]is refused, sinceF[A]against a known instance cannot be taken apart whereFis itself a parameter of the code matching). The declaration step enforces the last two through one rule: a result’s arguments are built of data types, classes, tuples, function types and the variant’s parameters, and any other form, a constructor or its application among them, is refused with"`F[A]` in the result of `V` is no type a `match` can take apart: the result's arguments are built of data types, classes, tuples and function types"; a constructor parameter among a variant’s own (V[G[_]]) is refused since the two branches met (branchgadt-2, the entry above). Fields name constructor applications freely, as any variant’s do. Why: refinement solves equalities by decomposition, which needs every parameter under a constructor that the instance’s head determines; an applied parameter is not one. Alternatives weighed: solvingF[A] = Xby matchingX‘s head (unsound whenFis a partial application, whose holes may sit anywhere amongX‘s arguments). Review with the user: whether refinement over constructors is wanted. -
Settled on the user’s delegation 2026-11-15 (branch
gadt-3, the refinement step): each pattern on a refined variant gives the variant’s parameters fresh types of its own, so twoPairpatterns, nested or one after the other, give two unrelated sets, and the equalities are solved with those fresh types first, then the enclosing code’s type parameters:Vector[A] = Vector[T]makesAtheTaround the arm, so a field reads as a type the code can name, andT = (A, B)keepsTas the pair of the fresh types. A union or a type constructor that names a type parameter is not taken apart and teaches nothing (T | string = int | stringhas two solutions); any other two different types, and a cyclicT = Vector[T], are a contradiction, which step 4 (branchgadt-4) makes an error at the pattern; the arm’s body is then checked with no equalities, and is not compiled at any copy. The equalities hold where a marker local the pattern declares beside its names is in scope, which carries them exactly where the names go: an arm, a clause, anistest’s branch, the right operand of&&and||, the rest of a block after an early return or a binding. At a copy where a pattern is impossible, lowering leaves out what holds its equalities: the arm, the branch anistest then cannot take, the right operand of&&and||, awhilebody, and the rest of a block whose taken branch never finishes. Why: the chapter’s “fresh types known only by these equalities”, and a substitution the arm’s code can read. Alternatives weighed: naming the fresh types by the data type’s own parameters (two nested patterns would share them); stopping with an error at an equality not taken apart (refuses sound programs). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-3): a variant’s own parameter that the equalities leave a fresh type never leaves its arm, as a hidden one does not (the chapter states it for hidden parameters only): with no type expected, an arm, a clause, anisbranch or a block whose result names one is refused with"this arm's result is an `Expr[A]`, and `A` is a type `Pair` takes from the value it matches, which is not known outside its arm", and an inference variable made before the pattern settled to one with"a type declared outside this arm cannot be settled to an `Expr[A]`: …", reported at the pattern. Why: such a type is known only through the value matched, so no copy can compile code outside the arm that names it. Alternatives weighed: settling the escaped type asNothing(lays out a value at the wrong type); allowing it (no copy could compile it). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-3): inside an arm a value of a type an equality fixes is used at what it is there for operators, members and comparisons (x + nwithx: TandT = intis anint), the type expected of an expression is the one under the equalities (a literal where aTthat is anintis expected is anint, a value where aTthat isAnyis expected is boxed), while an inference variable still settles to the type as written where it meets one. An arm that refines, with a type expected, is checked against it under its equalities and yields the expected type itself; one that does not fit it is refused with"this arm yields int, not the T expected of the `match`". Clauses with no declared result that agree on no type are reported as the chapter reports arms:"the clauses of `f` agree on no type: `IntLit`'s yields an `int`, which is `T` only inside that clause; declare the result type". Why: the chapter’s “a type and anything it equals are one type” and its “as written” rule for inference variables, each where it can apply. Alternatives weighed: rewriting every type in the arm to its refined form (would settle variables outside the arm to refined types, against the chapter). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-3):val V = x, whereVis a variant ofx‘s type and that type has refined variants, takes the value apart as the chapter’sval Refl = proofdoes; anywhere elseval Name = xbinds a name, as before. Review with the user: whetherval V = xshould take apart a value wheneverVis a variant in scope, as a bare name in a pattern does. Why: the chapter’s example, with no change for any program written before refined variants. Alternatives weighed: requiringval V() = x(not the chapter’s spelling); the general rule (changes what existing bindings mean). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-3): a field of a refined type’s one variant is read by name where the instance says the field’s type:o.valueonOne[T]withMk(value: int) -> One[int]is anint; an instance the variant cannot make is refused with"`One[bool]` has no values: no variant of `One` makes one", and a field whose type keeps a parameter the instance does not say with"the field `items` of `Hold` has a type a `Holder[T]` does not determine; take the value apart with `match`". Why: every value of the instance is the variant’s, so the read is the arm of a one-armmatch, and only its result type must be one known outside. Alternatives weighed: refusing every such read (the chapter’s single-variant types would lose field access). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-4, the coverage step): coverage counts the variants possible at the type matched as the equalities in scope see it, splitting a column on a refined type’s variant only where the variant’s result has a solution with the column’s instance, the variant’s own parameters given types of their own for that split; the solution carries to the other columns, so a row’s equalities travel along it, and an instance no variant makes is a column with no values. Why: the chapter’s Coverage, and the same solving the checker does for a pattern, so the two agree on what is possible. Alternatives weighed: carrying the equalities as a substitution beside the columns (the same, with every function of the coverage check threading it; applying them to the columns at each split needs no more state). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-4): an impossible pattern is reported at the pattern, by the checker, with the chapter’s three reasons, chosen by re-solving: against the equalities in scope before its row alone it fails (`Eq` makes an `Expr[bool]`, and the value matched is an `Expr[int]`, or the empty-instance message where no variant is possible), a cyclic equality (`Wrap` needs `T` to be `Vector[T]`, which no type is), or the first equality of an earlier pattern of its row that leaves it none (`IntLit` needs `T` to be `int`, and `BoolLit` in the same pattern needs it to be `bool`). A row is an arm’s pattern, a clause’s arguments (in the same clause), anistest’s pattern, a binding’s pattern. The lead says what never happens:this arm is never reached,this clause is never reached, andthis pattern never matchesfor anistest, a binding and one of a set of alternatives, which the chapter does not word. An impossible pattern on the right of&&, under the left’s equalities, is an error the same way. Amatchon an empty instance is an error at the value matched even when no arm names a variant (_ -> 0on aSame[int, string]). Why: the pattern is where the contradiction is, and a test that can never succeed is dead code as an arm is. Alternatives weighed: reporting impossible arms from the coverage check (it sees rows, not which equality failed, and would say only “never reached”); leaving an impossibleistest legal (it folds tofalseat every copy, which hides a mistake). Review with the user: the wording for tests, bindings and alternatives. -
Settled on the user’s delegation 2026-11-15 (branch
gadt-4): each alternative of a pattern matches on its own: the equalities an alternative learns hold neither in the alternatives after it nor in the arm, and lowering tests each alternative at what its own patterns read back from the value. A step-3 bug: an alternative’s equalities stayed in scope, soIntLit(_) | BoolLit(_) -> 5on anExpr[T]was checked as ifTwereint, and itsboolcopy answeredfalsefor the5; and an alternative was compiled without its patterns’ arguments, soPair(IntLit(3), _) | …never matched. Why: the arm runs for whichever alternative matched, so only what all of them imply could hold, and alternatives bind no names. Alternatives weighed: keeping the equalities every alternative implies (sound, but needs a meet of substitutions the chapter does not describe; no program has needed it). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-4): two types that read the same in a message are named apart by the refining patterns that took them:expected Expr[A of `Pair` on line 4], found Expr[A of `Pair` on line 5], with the column too where both patterns are on one line, in the expected/found, operator-operand,cannot compareand declared-result messages. Only where the two names would otherwise be identical; every other message is unchanged. Why: two patterns on one variant give two unrelated sets of fresh types with the variant’s parameter names. Alternatives weighed: numbering the fresh types (A1,A2), which every message would show, even where nothing clashes. -
Settled on the user’s delegation 2026-11-15 (branch
gadt-5, the hidden-parameters step): a hidden parameter has exactly the bounds its variant declares, and a trait derived for its type holds of it only by them:Hold[A](value: A)givesBoxno automaticDisplay,Debug,Eq,HashnorSendable, andHold[A: Display](value: A)gives itDisplay. A parameter of the type that a refined variant hides (Hide(value: T) -> Tagged[int]) is the value’s own, so the impl’s bound on the instance’sTdoes not give it the trait either. The reason a type has no automatic trait names the variant, its field and the hidden parameter (`Tagged` has no `Display` because its field `Hide.value` names `T`, which the variant hides and a value may hold at any type; bound it, as in `[T: Display]`), and an explicitderivessays the same. This settles step 2’s “the trait for now” per pack: the derived code’s arm is compiled once per pack, and only the bounds hold at every pack.==and the hash still compare and hash every value, a pack at a time. Consequence: the chapter’sExpr, whoseFirsthidesB, has no automaticDisplayunlessFirstwrites[A, B: Display & Debug]. Why: a derived impl is checked once and must hold wherever any value is, and a pack’s types are known only where the value is made; deciding by bounds keeps the type’s traits a fact of its declaration. Alternatives weighed: giving the trait unconditionally (unsound: a value of a pack without it reaches the derived code); requiring the trait of the hidden types where each value is made, whenever the type derives it (everyBoxmade of a class withoutDisplaywould be an error, though the program never shows one, and generic code could not know whether its instance derives it); rendering a hidden field through its type record (DisplayandDebugonly, and a change to the derive templates). Review with the user: whetherDisplayandDebugshould rather render a hidden field through its run-time type, soExprprints without the bound. -
Settled on the user’s delegation 2026-11-15 (branch
gadt-5): a bound on a hidden parameter is allowed,T: A & Bincluded; a bound on a variant’s own parameter that its result names was left to step 6 (branchgadt-6, the entries below). A hidden parameter’s bounds are checked where a value is made, as a call’s are, and the fresh type an arm gives it has them. Why: the chapter states them for hidden parameters in their own section (“a fresh type, with the bounds its declaration gives it”), and the typed protocol needsAsk[R: Sendable]; what step 6 adds, an enclosing type parameter gaining a bound by equality, does not arise for a hidden one. Alternatives weighed: leaving every bound to step 6 (the protocol could not be written in step 5). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-5): anistest or a binding takes apart no field of a hidden type:if b is Hold(v, _)withvalue: Ahidden is refused with"`Hold` hides `A`, and its field `value` names it: an `is` test or a binding takes apart no field of a hidden type; take the value apart with `match`, whose arm is compiled for each type the value hides";b is Hold(_, _, t), testing or binding only fields whose type every pack shares, is accepted and tries each pack. Amatcharm, a clause, a match function and an actor’s or machine’s arm take any field. Why: an arm is one expression, compiled once per pack; anistest’s equalities reach the rest of a block after an early return or the right operand of&&, code that would have to be copied per pack as far as the names reach. Alternatives weighed: copying the reached code per pack (a block’s rest, an&&chain and awhilecondition each need their own copying); refusing every hidden pattern in a test (the tag test and the shared fields are sound and useful). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-5): an arm on a variant with hidden parameters is compiled inline, once per pack, and chosen by comparing the value’s descriptor with each pack’s, not as a function called through the descriptor’s method table as the build plan said. Lowering finds the packs as it reaches the code making them; an instance compiled for fewer packs than the program has made by the end is lowered again, until none is stale, and such instances are not kept in the instance cache. Why: an arm compiled inline keepsreturn,break,continue, avarof the function and a tail call behaving as in any arm, which a separate function would have to pass back across a call; the run-time cost is one compare per pack before the arm, against a call through a table. Alternatives weighed: the plan’s function per pack through the table (each arm would need its locals captured and its exits returned as codes); boxing hidden fields behindAny(the chapter’s alternative, a run-time test where none is needed). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-5): in the polymorphic-recursion check, a refining pattern’s fresh types are its variant’s parameter nodes, a value made with hidden types reaches them, and a type argument holding a hidden type grows no parameter of the code that the value matched holds: soeval(First(p)) = … eval(p)at(T, B)is ordinary, as the chapter says, while a pack built from ever larger hidden types (Hold(v) -> grow(Hold([v]))), a generic function making a pack of its parameter whose arm calls it larger, and a parameter grown beside a hidden type of a value not holding it, are refused as polymorphic recursion naming the variant. Why: an instance at a hidden type exists only for a pack, which a value made somewhere holds, and a matched value holding the parameter can be of a larger pack only where the program made one; growth through the values made is counted by the construction edges. Alternatives weighed: counting every type argument as before (refuses the chapter’seval); dropping every edge of an argument naming a hidden type (acceptspairUp((x, y), b), which never ends). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-6, the bounds step): an enclosing type parameter gains a variant parameter’s bounds only where an equality in scope equates the two as wholes: withSorted[A: Ord](items: Vector[A]) -> Coll[A],Tofsmallest[T](c: Coll[T])isOrdin theSortedarm, a parameter equated in a tuple place (Conv2[A: Into[B], B](…) -> Conv[(A, B)]on aConv[(X, Y)], whereXgainsInto[Y]) too;Uof aColl[Vector[U]]gains nothing, thoughVector[U]isOrd. The bound holds where the arm’s equalities do: not among alternatives, not after the arm, not in the other branch of anistest. Why: the chapter states it for “a fixed parameter equated with a type parameter”, and inferringU: OrdfromVector[U]: Ordwould invert an impl’s condition, which holds only where no other impl gives the trait. Alternatives weighed: inverting conditional impls (unsound wherever a type has the trait unconditionally); rewritingTto the variant’s fresh type in the arm (the arm’s result would then be checked as a type that leaves its scope). -
Settled on the user’s delegation 2026-11-15 (branch
gadt-6): a variant’s bounds do not prune coverage: amatchon aColl[Thing], withThingnotOrd, still needs aSortedarm (or a wildcard), whose code is checked atThingwithout the bound, as the chapter’s coverage rule counts equalities alone. Lowering does leave the variant out of the instance:Coll[Thing]‘s layout has no descriptor forSorted, and an arm, anistest or the derived code on it is not compiled there, as for a variant whose equalities fail. Why: coverage stays a fact of the types’ shapes, unchanged by which impls the program declares (an impl added in another module would otherwise make a coveringmatchincomplete). Review with the user: whether an arm on a variant whose bounds a concrete instance fails should rather be “never reached”, as an impossible arm is. -
Settled on the user’s delegation 2026-11-15 (branch
gadt-6): whether a refined type is sendable is decided at its instance: a variant’s own parameters are read back from the instance’s arguments, soColl[string]is sendable thoughSorted‘sAis bounded byOrdalone, and a variant whose result is another concrete instance holds nothing there (Msg[int]is sendable thoughLog, making only aMsg[string], holds aBuffer). Where generic arguments do not say what a parameter is, one bounded bySendableis sendable, as a hidden one is, and any other may be any type. A hidden parameter is still decided by its bounds alone, per thegadt-5entry: every pack the program makes was checked where its value was made. Why: before, a refined variant’s own parameters were read by position, so every instance of a type withSortedwas unsendable, and an actor could not receive one. Alternatives weighed: requiringSendableon every own parameter (a bound the instance already decides). -
Settled on the user’s delegation 2026-11-15 (branch
ascription; ascription itself approved by the user 2026-11-13): Type ascription(value: T), written as an item of a parenthesized list (types). (1) Where it parses: a group, a tuple’s part or a call’s argument (a named one’s value included), never a barevalue: Telsewhere. WHY: inside parentheses:has no other meaning (named arguments use=, a map literal’s:is inside braces, a field’s or parameter’s type is in a declaration), so the grammar stays unambiguous with no new token; at a statement’s levelx: Twould read as half of a declaration. ALTERNATIVES: barevalue: Tanywhere (collides withval x: T, clause signatures and a match arm’s type patternn: int -> …); a keyword (value as T, a word read as a conversion, which this is not); parentheses only for a group, not for arguments (f((None: Option[string]))doubles every bracket). (2) What it accepts: exactly whatval x: T = valueaccepts — literals takingT,None, empty collections and lambdas typed byT, a subtype’s value, a union’s member — and the expression is of typeT. WHY: one rule a reader already knows, and no conversion hides in a form that looks like a type. ALTERNATIVES: also converting numbers ((n: long)of anint), which is the implicit widening the spec refuses; accepting narrowing as a checked downcast, which is amatch‘s job. (3) The refusal says what to write:long(n)for a numeric conversion,BigInt(k)/T.fromInteger(k)for an integer variable to a type that takes integers, the explicitBigDecimal.fromReal…for areal, andis/matchfor a narrowing. (4) Ambiguities settled:(n: long) -> …stays a lambda;x: int -> bodywhose rest is not type-shaped keeps its hint “a lambda’s parameter with a type is written in parentheses”, while(f: int -> int)is an ascription to a function type; at the start of a block’s linename(x: T)followed by=,->, an indented block or a clause line still declares a local function, and a clause signature now needs its next line to be a clause (followed by=,|or guards), so twoshow(n: long)calls on consecutive lines are calls; a parameter counts as typed only when a name precedes its:, soshow(1: long)is never a declaration. (5)(_: T)in a placeholder lambda is a parameter of typeT. WHY: it is the one place a placeholder’s type can be written. ALTERNATIVES: leaving_untyped inside an ascription (the ascription would still constrain it, but a mismatch would read as the ascription’s error rather than the parameter’s). Review with the user: (1)’s rule that a statement-levelretry(n: long)followed by an indented block is a declaration (writeretry((n: long))to call it).
Actor patterns (actors, branch actor-patterns)
- Settled on the user’s delegation 2026-11-15 (branch
actor-patterns): Routers areRouter.pool(size, behaviour, routing, onFailure, executor), giving back a plainActorRef[M]. The router is an actor of its own, the routees its children, so the lifecycle and supervision of actors cover it with nothing new:stop(router)ends the routees first, a routee’sonFailureis the router’s argument, a routee that ends leaves the pool and the router stops with the last one, and a routee’s escalation fails the router, which always escalates (the router’s own supervision is not a parameter). The routings are thedata Routing[M]:RoundRobin(the default),AtRandom,SmallestMailbox,ByKey(key: @sendable (M) -> long). Why: one reference that accepts the routees’ own messages is what a caller wants, and asks through it work unchanged; a hop through the router keeps one sender’s order per routee and keeps the pool’s state in one actor’s turns, with no lock. Alternatives: a reference whosetellpicks a routee in the sender’s thread (no hop, but the pool’s changing membership shared between threads); aRouter[M]object with its ownstop(a second lifecycle beside the actor’s); a supervision parameter for the router itself (rarely wanted: it holds no state worth restarting).Randomwas not taken as a variant name sinceavin.random.Randomis a common import;Routershares its name withavin.net.http.Router, in a different module. Review with the user: the names (AtRandom,ByKey) and the router’s fixedEscalate. - Settled on the user’s delegation 2026-11-15 (branch
actor-patterns):SmallestMailboxcounts the messages waiting, andByKeyhashes by highest weight. A routee’s mailbox alone keeps a count (an atomic add on each send and take; other actors’ mailboxes pay nothing), the message being handled not counted, ties going to the next in turn.ByKeyweighs each routee against the key by mixing the key with the routee’s number and takes the heaviest, so a key keeps its routee while it lives and a routee that ends moves only its own keys. Why: the count is exact and cheap where it is needed; the weighting needs no ring and stays consistent as the pool shrinks. Alternatives: counting every mailbox (a cost to every actor); counting a message until its handling ends (a second atomic per message); the key modulo the pool’s size (every key moves when one routee leaves); a hash ring (more state for pools that are small). - Settled on the user’s delegation 2026-11-15 (branch
actor-patterns): A message a router finds refused goes to another routee. A routee that has begun to end refuses a message, and the router chooses again among the rest, before it has heard of the end; a message a routee accepted and then dropped as it stopped is lost, as with any actor that stops. Why: the window between a routee ending and the router hearing of it would otherwise lose messages for no reason. Alternative: dropping them. - Settled on the user’s delegation 2026-11-15 (branch
actor-patterns): AStashis a bounded object of the actor’s state,Stash(self, capacity), and adding to a full one traps.unstashAllputs its messages in front of every message waiting, in the order added, in a queue the actor’s turn reads before its mailbox, so a restart keeps them as it keeps the mailbox, while what is still stashed is lost with the state. Why: the actor’s own state is where an actor’s choices live, and a stash made from the actor’s own reference cannot be given another actor’s messages; a full stash means the actor’s design did not foresee the load, which is a bug for supervision to handle, and an actor that wants another policy checksisFullfirst. Alternatives for overflow: dropping the newest or the oldest silently (a lost question looks like a timeout with no report),addanswering abool(easily ignored); for the shape:stash(message)andunstashAll()onActorContextwith a capacity given tospawn(state outside the actor’s fields, and a parameter every actor carries); unstashed messages put at the back of the mailbox (behind messages that arrived later, losing order). Review with the user: trapping on overflow. - Settled on the user’s delegation 2026-11-15 (branch
actor-patterns): ATopic[E]is a sendable object, not an actor.publishtells each subscriber in the publisher’s own thread, so one publisher’s events reach each subscriber in order with no hop; subscriptions live in one atomic value; a subscriber’s end is watched through itsended()future from its first subscription, which drops it. An actor is subscribed once, by its number, the later reference (an adapter, say) replacing the earlier in its place. Why: any thread may publish, nothing needs stopping, and no actor’s mailbox sits between publisher and subscriber. Alternatives: a topic actor that subscribers and publishers message, watching subscribers withwatch(an extra hop per event, a lifecycle to manage, and a count that is only known by asking); topics named in a global registry (shared mutable state by name).
Higher-kinded types (generics, branch hkt-design)
-
Settled on the user’s delegation 2026-11-15: a constructor parameter is spelled
F[_],F[_, _]for two holes, and a partial application of a type writes_for each argument left open:Result[_, ParseError],Map[string, _]. Why: the same mark at the declaration and at the use, the_the language already uses for “something left out” in patterns and lambdas, and the spelling other chapters’ prose already used for “aResultof any value with this error”. Alternatives weighed: a kind annotation (F: * -> *, notation with no other use in the language); a type-lambda form ([X] => Result[X, E], general but a second way to write types, and lambdas make constructor equality undecidable in general); declaring the constructor by an alias only (every partial application would need a named alias). Review with the user: the spelling is the most visible choice of the design. -
Settled on the user’s delegation 2026-11-15: holes are direct arguments of one nominal type; no nested
_, no constructors of constructors (F[_[_]]), no tuple or function constructors. A generic alias whose parameters are each one direct argument of its expansion is a constructor too. Why: a constructor is then a nominal type with places left open, so equality is structural and inference has one answer, the core of the soundness argument; composition (Option[List[_]]) is a data type of the program’s own. Alternatives: general type lambdas (undecidable equality, inference with many answers); allowing any alias as a lambda (the same problem behind a name). Review with the user: whether composed constructors are wanted soon. -
Settled on the user’s delegation 2026-11-15: a hole may declare variance (
F[+_]) and bounds (F[_: Sendable]), a demand on the constructor passed:+_letsF[Dog]be anF[Animal]inside the declaration and takes only constructors covariant there; a bounded hole is applied only to types meeting the bound, checked at eachF[X]written, and takes constructors whose parameter’s bounds the hole’s imply. A plain_is invariant and unbounded, and refuses a type with a bounded parameter at the hole (TreeSet). Why: each is checked at the definition, so no instance can fail; bounded holes are what letFuture(Sendable) and sorted collections (Ord) be constructors at all. Alternatives: always invariant (losesF[Dog]asF[Animal]where code wants it, at no gain in simplicity); always covariant (unsound forArray); refusing bounded types outright (excludesFuturefrom comprehensions). -
Settled on the user’s delegation 2026-11-15: constructor traits are spelled with
Self[…], the trait’s parameters being the holes:trait Functor[A]withmap[B](f: (A) -> B) -> Self[B], bounds written[F[_]: Monad]. Why: it reads like every other Avin trait (Iterable[+A]withmap[B]), keepsimpl Trait for Typeas the one form of conformance, and the common case (callingfa.map, writingimpl Monad for Parser) needs no new notation beyondSelf[B]. Alternatives: a type-class-style trait over an explicit parameter (trait Functor[F[_]]withmap[A, B](fa: F[A], …), which puts the receiver in a parameter and makes every callF.map(fa, f)or needs a second rule for method syntax); marking constructor traits with a keyword (redundant:Self[B]already says it). Review with the user. -
Settled on the user’s delegation 2026-11-15: a constructor trait is a bound and never a type, its parameters take no variance, and its static members name none of them. Why: no object of unknown constructor exists, so no dynamic dispatch over constructors and no existential is needed; every call is direct in a monomorphized instance. Alternatives: trait objects of
Monad(need a run-time constructor witness and type erasure of the element, which reification refuses). -
Settled on the user’s delegation 2026-11-15: an impl gives the trait the type’s parameters it leaves open (
impl[T, E] Monad[T] for Result[T, E]), and both may be left off where all are open, in order (impl Monad for Option). Why: the partial application needs no new syntax at the impl, and the common one-parameter case reads as plainly asimpl Ord for Money. Alternatives: writing the constructor (impl Monad for Result[_, E], which needsEdeclared somewhere); requiring the full form always (noise in the common case). The bare form is the only impl of a generic type without its parameters, a narrow exception. -
Settled on the user’s delegation 2026-11-15: a type implements a constructor trait once, at one choice of holes, and the conformance is not inherited by subclasses or through traits. Why: coherence gives each argument one constructor; an inherited
mapanswers the superclass’s type, so inheriting would be unsound. A subclass instance is matched as its nearest superclass with a conformance, then the one trait with one. Alternatives: a conformance per hole (Eithera functor on both sides, at the cost of ambiguous inference); inheritance with a check that every method is overridden at the subclass’s type (a long tail of overrides in the library). -
Settled on the user’s delegation 2026-11-15: a type’s own methods implement a constructor trait’s where the trait’s call is a call of them with no conversion, no extra bound, their own type parameters decided by the call (a lower bound by its bound) and a result conforming to the trait’s. Why:
List,Vector,Option,ResultandEithermeet the family with their existing overloaded and lower-boundedflatMaps, so no collection method is duplicated or changed. This is still nominal: the impl declares the conformance, and the rule only says which declared method serves. Alternatives: exact signatures (forces a secondflatMapon every collection, an overload clash); adapters generated per mismatch (hidden code and conversions). Review with the user: it is a looser meeting than a class’s override, which takes the parameter types exactly. -
Settled on the user’s delegation 2026-11-15: inference of a constructor goes through its bound’s conformance; without a bound only a type of exactly the parameter’s arity is inferred, anything wider needs
Fwritten; the written-out arguments join by the type’s variance (Ok(1)beside aResult[int, E]); two different heads never join. Why: the impl is the one place that says which argument varies, and joining the fixed arguments keepsNothing-typed literals pleasant. Alternatives: the last argument always the hole (wrong forResult, whose value is first); unification over every choice of holes (ambiguous, order-dependent). -
Settled on the user’s delegation 2026-11-15: a constructor trait’s default bodies are compiled once per implementing constructor and may call its static members on
Self. Why:Monad‘smapandmap2fromflatMapandpure, so a program’s own monad gives two members. Alternatives: no defaults (every monad writes four members); defaults shared through a method table, as other traits’ are (noSelfto callpureon). -
Settled on the user’s delegation 2026-11-15: impls may add to applications of a bounded constructor parameter (
impl[F[_]: Traverse, G[_]: Applicative, A] F[G[A]]), matched through the conformance, with the rules of impls adding to types built from parameters. Why:xs.sequence()reads as a method, and a package can extend every monad at once. Alternatives: free functions only (sequence(xs)). -
Settled on the user’s delegation 2026-11-15: the standard traits are
Functor,Foldable,Applicative,Monad,Filter,Traverse, and the sendable pairSendableFunctor/SendableMonad, in moduleavin, withApplicative‘s second membermap2andFoldableholdingfoldLeftalone. Why:Foldableis warranted becauseOption,ResultandEitherare noIterables andTraverseneeds a fold;map2reads better than anapover functions;Filteris the nominal home of a comprehension’s guard; the sendable pair is howFuture, whose combinators needSendablevalues and@sendablefunctions, meets a family. Alternatives:ap(the classic, harder to read);zip/productas the second member (zipalready pairs sequences by position andproductmultiplies); noFoldable(no fold over an option in generic code);Futureleft out (breaks comprehensions over futures). Review with the user: the names, and whether the sendable pair should rather be a hole bound on the ordinary traits. -
Settled on the user’s delegation 2026-11-15: which library types implement what:
Option,Result[_, E],Either[L, _]and the immutable sequences (List,Vector,ArraySeq,Queue,Seq) the whole family,Filterexcept onResultandEither;LazyListall butTraverse;Array,Buffer,DequeandSetFunctor,FoldableandFilter;Futurethe sendable pair;Map, the sorted collections,IteratorandRangenone, each for the reason its signatures show. A sequence’smap2is cartesian, as itsflatMap. Why: each impl is lawful, and the laws are tested. Alternatives:Monadfor the mutable collections (lawful, butpuremaking a mutable array surprises);Mapas a functor over its values (itsmaptakes entries, so it needs a method of another name). -
Settled on the user’s delegation 2026-11-15:
forcomprehensions admit their sources by conformance: the last generator anIterableor aFunctor(orSendableFunctor), an earlier one anIterableor aMonad(orSendableMonad), a guard anIterable(through its lazywithFilter, whose views becomeIterables) or aFilter(throughfilter); in generic code the bounds decide; the calls are then checked as written out, so mixed sources (for w in words, n in parse(w)) keep working through the collections’ own overloads. A type withmapandflatMapand no impl is no longer a source: the error says which impl to declare. Why: the user’s rule that Avin is nominal; the structural rule admitted any type with methods of those names. Alternatives: keeping the structural rule (contradicts the rule); desugaring every comprehension through the traits’ members only (loses the collections’ precise mixed-source results andwithFilter‘s laziness, a visible change in the order of evaluation). Built on branchhkt-8(admitted_sourceincheck.sysl;tests/run/for_yield_conformance{,_gc}.avin,tests/reject/for_yield_roles{,_more}.avin,tests/reject/for_yield_generator_mismatch.avin), with a definition a guard follows askingMonadof its source, as the collections chapter says, though itsmapandfilterwould need onlyFunctorandFilter. Review with the user: it breaks programs whose own types relied on the structural rule, each fixed by oneimpl; and whether a guarded definition should ask onlyFunctor. -
Decided by the user 2026-11-14: a built-in type’s name in a pattern is a type pattern:
x is inttests the type and an armint ->matches an int, for every name in the table of built-in types, the sized integersiNincluded; generic forms stay_: Vector[int]; a name with a binding isn: int. Built on branchis-type-name, wherex is inthad bound a newintand was always true (tests/run/operands_for_traits.avintested nothing). Proposed with it:- Such a name never names a value: a local (
val,var), a function’s, a lambda’s or a class’s parameter, a data field, and a pattern binding it (int: T,int @ p,int + 1, a comparison pattern,int*) are errors,`int` is a built-in type, so it cannot name a valueand…, so a pattern cannot bind it: alone it tests for the type, and `n: int` binds the value as one. Why: with the names type patterns,val (a, int) = pwould test whereval int = 3binds, andint(x)in an expression would mean the conversion or the local by context; refusing them everywhere keeps one meaning per name. It also settles the hiding rule for built-in statics:val string = …; string.byteLengthno longer arises. The library and tests renamed their locals (unit→identity/scale, the vector tree’si1–i6→d1–d6,long,real,intlocals in tests). Alternatives: allowing them asval/parameter names and refusing them only in patterns (two meanings for one name, and destructuring differs from a plain binding); allowing only the eight word names and leavingiNfree (the user listed the sized integers). Review with the user:i1,i2, … are common index names, and they are refused too. - Every type’s name in a pattern is its type pattern (the same decision, extended by the
director 2026-11-14 after
a is Cellwas found binding too): a bare or dotted name with no parentheses that is no variant but resolves to a class, trait,object,datatype, alias,Any,Nothingor type parameter is_: T. A variant wins where both exist, sodata Cell(value: int)‘sCellstays the variant’s pattern and every variant pattern is unchanged. A local, a parameter (of a function, local function or lambda) or a pattern binding named after a type in scope is refused:`Cell` is a type, so it cannot name a value: in a pattern it tests for the type, and `x: Cell` binds a value of it. Fields named after a user type are not refused (they are reached as members, and a data field’s pattern is positional). Why: one meaning per name in a pattern; a capitalised name quietly binding was the same defect. Alternatives: only refusing capitalised bindings that shadow a type (keeps the always-true test as an error rather than a feature); including field names (more renames for no pattern ambiguity). - A generic type’s name alone in a pattern is refused,
`Box` is a generic type, and a type pattern names its type arguments, as in `_: Box[int]`. Why: a type pattern compares type arguments exactly, and the run-time test of “aBoxat any arguments” would be a new kind of test with no sound meaning for variance and value-type arguments yet. Alternatives: testing the class at any arguments (needs a class-only run-time test and a binding type,Box[?], Avin lacks); inferring the arguments from the matched type (works only where they are known, and reads differently by context). Review with the user if a “any instance ofBox“ test is wanted. - A type alias in a constructor pattern,
P(a, b), stays refused as before. - Functions and methods may still be named so (
cli‘sint(name)andstring(name)options): a function is called, never matched, so no pattern can mean it. A missing-member witness still reads_: string, which is the same pattern.
- Such a name never names a value: a local (
-
Settled on the user’s delegation 2026-11-15 (branch
fix-core-promises): the standard library’sSendablepromises are checked against the structure, except where@trusted_sendable("why")marks a class (actors). This replaces the 2026-11-05 settlement’s “the standard library’s promises are taken as made”, under whichMap.withDefault(f)answered a sendable map holding a plain function and a thread raced on what it captured. The mark is a class annotation (it trusts the class whether its header or an impl makes the promise), takes one non-empty string saying why the class is safe, is refused outside the standard library, and is an error on a class that promises nothing. Seventeen classes carry it:Lock,Condition,Mutex,Atomic,Channel,Thread, and the futures’Cell,PoolandRegistry(synchronization the runtime does); the runningActor(its turns are serial) andIsolated(an atomic state arbitrates its objects);TcpStream,TcpListener,UnixStream,UnixListener,TlsStreamandChild(one owner at a time, checked by every operation).Future,Promise,ExecutorandOncebecame sendable by their structure,Cellgained animpl[T: Sendable] SendableandLocka: Sendablefor it. Why: the trust is greppable and each entry says its reason; trusting the innermost synchronized class rather than each composite keeps the list short and checks the rest. Alternatives weighed: a list of names in the compiler (invisible at the type, drifts from the library); trusting every class ofavin.threads(too wide: it hid nothing here, but would hide the nextDefaultMap); marking the composites (Future,Promise) instead ofCell(more entries, fewer types checked). -
Settled on the user’s delegation 2026-11-15 (branch
fix-core-promises):withDefault‘s function is@sendable, and theDefaultMapholds its default as a privateMapDefaultdata value,Fixed(v)orComputed(f), sowithDefaultValue(v)takes any value and the wrapper is sendable wherever the map andvare. Why:MappromisesSendableand every map is one, so the default must be sendable for the wrapper to keep the promise; most defaults (k -> 0,k -> k.length) capture nothing mutable and are unchanged. Alternatives weighed:Mapnot promisingSendable(every immutable map would stop being sendable);DefaultMapalone not being aMap(breaksval m: Map[K, V] = ….withDefault(f)); keeping a plain function and making the wrapper not sendable (a trait’s implementers cannot opt out). Review with the user: a default that mutated a captured local (a call counter) now uses anAtomic. -
Settled on the user’s delegation 2026-11-15 (branch
fix-core-promises): aTlsStreamchecks its owner before every operation, through a token handle asChilddoes, so a stream handed to another thread traps its previous owner at a read served from the bytes read ahead; before, only a read that reached the socket checked, and a buffered read raced. Why: the same rule aTcpStreamkeeps. Alternative: none sound. -
Settled on the user’s delegation 2026-11-15 (branch
cache-trim): the build cache keeps itself within a limit, least recently used first, with no index: an entry is a program’s build directory (build/,test-builds/) or one object or archive (units/,runtime/,shims/,cunit/), and its modification time is its last use, touched by every build that takes it from the cache (a program’s directory when its build starts and before each testavin testruns). Every command that builds sweeps the cache at most once in ten minutes, a stamp file in the cache shared by every process, and evicts the oldest entries until the cache is withinAVIN_CACHE_LIMIT(a size withK/M/G/T,offfor none, default 5G; a value that is neither is an error from every command). Why: builds run in many worktrees and sessions at once, so a shared index would need a lock Sysl’s library does not offer, while a touch is one system call and the existing unit-object trim already worked by modification time. Alternatives: an index file of use times (a lock, and a writer killed halfway through it); access times (noatimemounts, and macOS updates them lazily); a sweep after every build (the size walk on every build); an hourly sweep (24G had grown within hours). Review with the user: the 5G default and the ten-minute interval. -
Settled on the user’s delegation 2026-11-15 (branch
cache-trim): nothing used within the hour is evicted, and an entry is renamed aside, looked at again and put back if a build touched it in between, before it is removed. Why: no build reading or writing an entry loses it, without a lock; a cache whose fresh entries alone pass the limit stays past it until they age. Alternatives: lease files naming the process (Sysl’s library has no way to ask whether a process is alive);flock(not in Sysl’s library); no grace (a sweep could take the executableavin teststarts once per test). A shim archive and the record of the libraries it needs beside it are one entry, the archive evicted first and a record newer than the sweep’s choice kept, so no build finds the record without its archive. -
Settled on the user’s delegation 2026-11-15 (branch
cache-trim): an entry gone from under a build is a miss, never a link error: every object and archive a build takes from the cache is touched first, and one missing (or a shim archive without its record) is built again; the link looks again at everything it takes from the cache before clang runs and after clang fails, answers an entry gone in between as such rather than as clang’s error, and the build then compiles again, which builds the entry anew, and links once more. Why: a cache emptied by hand, or by a disk being cleared, while builds ran made two gates fail to link a shim archive that had been there when the program compiled (2026-11-13). Alternatives: holding the entries open across the link (clang opens them by name); copying them out of the cache first (the copying costs every build). -
Settled on the user’s delegation 2026-11-15 (branch
cache-trim): another version’s cache is removed three days after its last use, judged by the newest time on it, its kinds and their entries, and only beside the default cache (never beside a directoryAVIN_CACHEnames), and only for a name that is a version’s. Why: no compiler of this version can read it, and three days spares a user switching back. Alternatives: removing every other version at once (an older installed compiler still in use would rebuild each time); never (the unreachable caches are what filled the disk). -
Settled on the user’s delegation 2026-11-15 (branch
cache-trim): fetched packages are outside the limit and never evicted by a sweep; a sweep removes only the debris of interrupted fetches, andavin cache clean --packagesremoves packages (with--older-than, those no build has read for that long; a build touches the package it reads). Why: a package is source pinned byavin.sum, small beside a build, and fetching it again needs the network and a tag that may since have been removed, so evicting one could break an offline or archived build. Alternatives: counting packages in the limit (evicted first, being rarely touched, for a few hundred kilobytes saved). -
Settled on the user’s delegation 2026-11-15 (branch
cache-trim): a sweep removes debris: anything in the cache whose name holds.pending-(a write that was never renamed into place) that nothing has written to for an hour, and in the temporary directory the directories a build works in (avin-link,avin-shims,avin-c-unitand the six charactersmake_temp_diradds) that nothing has written to for a day, and theavin-test-buildsones the compiler’s tests left before their builds moved into the cache’stest-builds/. Why: a killed or out-of-space build leaves these behind, and on this machine its tests had left 8,673 such directories. A program’s own temporary directories are never touched, whatever they are called. Alternatives: everyavin-directory (a program may name its own so); none (the debris is unbounded). -
Settled on the user’s delegation 2026-11-15 (branch
cache-trim):avin cache info | trim | clean:infoshows the cache, the limit, each kind’s entries and size, the total with its oldest and newest use, debris, fetched packages and other versions’ caches;trimsweeps now;cleanremoves every entry, the debris and other versions’ caches,--older-than <n>m|h|donly what no build has used for that long, and--packagesthe fetched packages too.avin cleankeeps its meaning (one program’s builds, or--allevery program’s). Why: the user sees what the cache holds and can empty it without knowing its layout. Alternatives: folding these intoavin clean(whose argument is a program). -
Settled on the user’s delegation 2026-11-15: a marked parameter survives a function becoming a value only through its type (branch
fix-fn-value-marks): a function, constructor or method whose parameter is@sendable,@isolatingor@isolatedis a value only where the value’s type gives that parameter a sendable type, which for a function is a@sendablefunction type; with no function type expected, the value takes that form of each marked function parameter (val sp = spawn[int]is a(@sendable () -> int, long) -> Thread[int]). A type that is a function (a class naming it, or an impl of it for a data type) has anapplythat marks a parameter only where its function type makes that parameter sendable, and a@sendableparameter matches a@sendablefunction type’s. Why: function types carry no parameter marks, soval sp: (() -> unit, long) -> Thread[unit] = spawnran a buffer-capturing closure on four threads, andIsolated/Mutexas values kept an object the caller still used. Alternatives: marks in function types ((@sendable f: () -> unit) -> unit; a second way to say what@sendable () -> unitsays for functions, and for a non-function@isolatingvalue a new kind of type); refusing every such function as a value, as a@threadedone is (also sound, butspawnandonExitcould never be held or passed). A by-name marked parameter has no sendable type, soisolateandFuture.applyare never values; an@isolatedfunction parameter takes the@sendableform, which asks a little more than the mark (no capturedvar). Method values keep their own wording, from the call inside the closure they are. -
Settled on the user’s delegation 2026-11-15: inside brackets a comma ends a
matcharm’s one-line body and thematch(branchfix-match-arg): in call arguments, tuple, collection literals andwithchanges, the comma after an arm (indented arms included) ends the arm, thematchand the item, sof(x match…_ -> 0, "a")passes two arguments; a tuple body there is parenthesized; a one-lineyieldvalue stops at the comma the same way. A comma after an arm when the next line at the arms’ depth reads as another arm (it starts withelseor holds an->outside brackets) is reported as a tuple that needs parentheses. Why: the indented arms were read as lines of a block, so the last arm’s body swallowed the following arguments as a tuple, a type error far from the cause; areturnvalue, a lambda’s and a one-lineif‘s bodies already stop at the comma. Alternatives: keep the arms a line context (the spec’s “an indented block starts a line again”), which makes_ -> 0, "a")a tuple and needs parentheses around the wholematch; or end thematchonly on the arm’s own line, which would read a middle arm’s comma silently. The arm-shaped-line check can misfire on a lambda argument written on its own line at the arms’ depth after thematch, a layout nothing writes. An indented arm body stays a block, where a comma list is a tuple (up to a last line that closes the brackets, below).
Higher-kinded types, kinds and written constructor parameters (build plan step 1, branch hkt-1)
-
Settled on the user’s delegation 2026-11-15: a type with a constructor parameter derives nothing through a template, and has no automatic
DisplayorDebug:derives Eqon a class,Hash,Ordor a library trait is refused with the parameter named, and a value is shown by its type, as a value of noDisplayis. A data type keeps its built-in structural==. Why: a template’s impl bounds each of the type’s parameters by the trait, a bound for types that no constructor parameter takes, and what displays anF[A]is unknown whereFis any constructor. Reviewed once step 2 landed (branchhkt-2) and kept: a hole’s bounds (F[_: Eq]) say whatFis applied to, never what anF[A]meets, so they give a derivation nothing to call. Alternatives: deriving through a bounded hole (unsound for the reason above:F[_: Eq]admits a constructor whose values have noEqof their own beyond identity); requiringF[A]: Displayper field (a constraint on applications, which impls over constructor parameters, step 6, are the place for). Review with the user: whether step 6’s impls over constructor parameters should now give a bounded hole’s types a derivation. -
Settled on the user’s delegation 2026-11-15:
F[-_]is parsed alongsideF[+_], as the spec writes only+_. Why: variance is written the same way everywhere else, and a contravariant hole is the dual demand (Ordering-like constructors). Alternatives: refusing-_until a use appears. -
Settled on the user’s delegation 2026-11-15: a type whose parameter is bounded is a constructor only for a hole whose bounds imply that bound (step 2, branch
hkt-2, replacing step 1’s refusal of every such type at any hole): a hole’s bound implies a parameter’s where it is the same trait or class, or one that is an instance of it (a trait requiring it, a subclass), asOrdimpliesEq;EqandHashneed no hole bound, since every Avin type has them (which is what letsMap[_, V]andSetbe constructors for a plain_); a parameter’s bound that names the parameter itself is implied by no hole bound. A constructor parameter passed for another is held the same way by its own holes’ bounds. The check is made where the type arguments are held to their bounds, so a constructor written and one inferred are refused alike, with one message. Why: anF[_]may be applied to any type, so a constructor with a bounded parameter could otherwise be instantiated at a type its bound refuses; implication is the least the hole must promise. Alternatives: checking each application at instantiation (an instance could then fail, against the design); entailment through impls with bounds of their own (no case needs it yet). -
Settled on the user’s delegation 2026-11-15: every
F[X]a declaration writes is held to the bounds ofF‘s holes where it is written, once per application, with the message “Xdoes not conform toB, the bound ofF‘s argument inF[_: B]“: a signature namingF[A]twice for anAwithout the bound reports both. Why: the spec’s rule is “checked wherever the declaration writesF[X]“; each place is a separate mistake to fix. Alternatives: one report per declaration (hides the second place). -
Settled on the user’s delegation 2026-11-15: a hole’s variance is what makes
F[A]variant (step 2, replacing step 1’s invariance of every applied argument): inside the declaration an argument ofF[A]is at the position its hole gives it, kept at+_, flipped at-_, invariant at_, so+Ain a fieldF[A]is accepted forF[+_]and refused forF[_];F[Dog]is anF[Animal]only at+_(andF[Animal]anF[Dog]at-_), where the arguments are references, as for any type. At each constructor passed, written or inferred, the type’s parameter at a+_hole must be covariant and at a-_hole contravariant; a constructor parameter passed must declare that variance on its own hole. Why: the subtyping assumed inside the declaration is then exactly what each instance grants. Alternatives: none sound that keepF[+_]useful. -
Settled on the user’s delegation 2026-11-15: a constructor parameter has no
Nothingdefault: one that is neither written nor inferred is an error, where a plain type parameter left unconstrained defaults toNothing. Why: there is no “empty constructor” to default to. Alternatives: defaulting to a constructor ofNothing(meaningless as a constructor). -
Settled on the user’s delegation 2026-11-15: with overloads, the first candidate’s type parameters decide which written argument is resolved as a constructor, before a candidate is chosen. Why: written type arguments are resolved once, before overload resolution, and overloads differing in the kinds of their type parameters are rare; resolving per candidate would need resolution repeated per overload. Alternatives: resolving the arguments once per candidate (correct for mixed kinds, more work in the hottest path); refusing overloads whose type parameters differ in kind. Review with the user if overloads of mixed kinds turn up.
-
Settled on the user’s delegation 2026-11-15:
_alone as a written argument at a call is read as a hole, so that the checker says what the argument takes (_alone names no type, or_is no type at a type parameter) instead ofunknown type. -
Settled on the user’s delegation 2026-11-15: a
forloop admits its source by conformance toIterable(branchnominal-for-in): besides a range written in place, aRangeand an array, the source’s type conforms toIterableat some element type through its class’s or data type’s parents and impls, a type parameter’s bounds, a built-in type’s impls, or, for a union, every member’s. A type with aniterator()method and no conformance is refused, the error naming the type and the impl to declare;OptionandEither, which haveiterator()but are notIterables, are refused too, an option pointed attoList. Why: the user’s rule that Avin is nominal, and collections.md already said a class is iterable by conforming; the structural check admitted any type with a method of that name. Alternatives: admittingOptionas a loop source (it is not anIterableanywhere else, so a loop would be the one place it acted as one); refusing unions (each member conforms, and the loop’siterator()call is answered by every member). -
Settled on the user’s delegation 2026-11-15 (built on branch
select): Aselectblock’s syntax (Threads).selectending its line opens a block of arms written as a match’s:ch.receive() as P -> body,ch.send(x) -> body,after d -> body, andelse bodywith no arrow;end selectmay close it.selectis a contextual word, a name anywhere else, asactorandexportare. Why: the arms read as the match arms they are compiled into,->is Avin’s one arrow (=>is rejected everywhere), andelseis spelled as a match’s is. Alternatives weighed:=>arms as in the item’s sketch (refused by the lexer and by the settled rule on arrows); a reserved keyword (breaks every program naming somethingselect, and the library’s own prose); a library function taking lambdas (no binding by pattern, noreturn/breakfrom an arm, every arm a closure). -
Settled on the user’s delegation 2026-11-15 (built on branch
select): What a receive arm’s pattern means.Some(p)waits for a value and binds it byp, any irrefutable pattern avaltakes;Nonewaits for the channel closed and drained; a name waits for either and binds theOption;_or no pattern waits for either. Any other pattern (a literal, a tuple, alternatives, a type pattern) is an error. SoSome(p)alone is never ready on a closed, drained channel: a select whose only arms want values from closed channels takes itsafterorelse, or waits for ever, as a select over a channel no one sends to does. Why: the pattern says what the arm waits for, so an arm never takes a value it then cannot match, and the common loop (Some(j)andNonearms) reads as a match on whatreceivereturns. Alternatives weighed: trapping where a closed channel’sNonematches no arm (turns a finished producer into a crash), any pattern with an unmatched receive dropped (loses values). Review with the user: whetherSome(p)alone on a closed channel should wait or trap. -
Settled on the user’s delegation 2026-11-15 (built on branch
select): Choosing and evaluating. Every channel, value sent andafterduration is evaluated once, in the order written, before any arm is tried; the arms are tried in an order drawn at random each select (a Fisher–Yates shuffle from one shared split-mix sequence), so of several ready arms each is equally likely.afterandelsetogether are an error (a select withelsenever waits); two of either is an error. Anafterof zero or less tries the arms once, aselsedoes. A send arm on a closed channel traps when it is tried, assenddoes. Why: the order of evaluation is the order of reading; a random order is the only fair one that needs no state per select site. Alternatives weighed: round-robin per select site (needs a hidden mutable per site, shared between threads); trying in written order (starves the later arms); a send arm on a closed channel never ready (hides the program’s mistake). -
Settled on the user’s delegation 2026-11-15 (built on branch
select): How a select waits. It waits on the very conditions a channel’sreceiveandsendwait on: in one pass, each arm is tried under its channel’s lock and, where it cannot complete, a link of the select is enlisted on that condition’s queue before the lock goes; the thread then parks once. The runtime wakes a link as it wakes any waiter, and the select’s one token decides, by compare-and-set, whether a notification, the timer or a cancellation ended the wait; a notification reaching an ended select’s link is passed by to the next waiter. Woken through an arm, the select tries that arm first and, where it cannot complete while the channel still holds a value (or room), notifies the next waiter, so no notification is lost to a select that could not use it; every link is withdrawn when the wait ends. Why: a channel’s own operations are unchanged, a select costs one park, and a plainreceiveand a select share one queue in arrival order. Alternatives weighed: a list of selects on each channel woken on every change (wakes every waiting select for each value, a herd of thousands where workers share a channel); passing every unused notification on whatever the channel holds (idle selects hand one notification round for ever: two thousand workers ran forty times slower); a select polling with sleeps (latency and wasted work). -
Settled on the user’s delegation 2026-11-15 (built on branch
select): The library names a select is read into are public:avin.threads.SelectArm,SelectReceive,SelectSend,selectWaiting,selectOrElse,selectWithin, andChannel‘sofferReceive,offerSendandpassOn. Their wait parameter is of a type private toavin.threads, so no program can call an arm’s operations. Why: the code aselectis read into is checked in the program’s file, so what it names is public, as the actor’sActorContextis; members have no module-wide visibility. Alternatives weighed: a member visibility private to the module (a language change of its own); intrinsics the compiler calls directly (the arms are generic, and the channel logic belongs in Avin). -
Settled on the user’s delegation 2026-11-15 (built on branch
timing):afterandTickerare channels holding a clock, not a timer (Threads).after(d) -> Channel[Instant]andTicker(period)with its channelticksgive ordinaryChannel[Instant]s whose next value’s due time is kept in the channel; the first receive,tryReceiveor select arm that looks once it is due delivers it, a waiting receive waits on its condition until then at the most, and a select parks until the soonest due time among its arms’ channels, then tries them again. The value is the instant the time fell due (the wall clock, offset by the monotonic clock’s lateness), not when it was received. Why: anafternobody receives from, the common loser of a select, then leaves nothing behind (no timer in the runtime’s heap, no thread, no registration) and is collected as any object is, whatever its duration; a channel is what a select arm takes, so no new arm kind or receive-only type is needed. Alternatives weighed: a thread perafterthat sleeps and sends (lives for the whole duration, ten thousand hour-longafters holding ten thousand stacks); a runtime timer that sends when it fires (needs the runtime to run Avin code from its timer thread, and a timer to cancel by finalizer when the channel is dropped); a receive-onlyTimertype (a second kind of select arm for the same wait).Channel‘swakeAt,startClockandstopClock, which the select and the clocks call, are public as the select’s names are, each taking a type private toavin.threads, so no program can call them. -
Settled on the user’s delegation 2026-11-15 (built on branch
timing): Nothing sends to a channelafteror aTickermade. Asend,trySend, timed send or select send arm on one traps;closeis allowed and ends it, no value delivered after. Why: the channel is the clock’s; a value sent into it would take the tick’s place or sit beside it, and Avin has no receive-only channel type to make the mistake a compile error. Alternatives weighed: letting sends through (a receiver could not trust a value to be a tick); a receive-only channel type (a language feature of its own, which a later decision could still add, making this a compile error). Review with the user if a receive-only view ofChannelis wanted. -
Settled on the user’s delegation 2026-11-15 (built on branch
timing): A ticker drops the ticks a slow receiver misses, andstopdrops a waiting one. The channel holds one tick; one falling due while it is held is dropped, and the ticker moves on to its first period after now. The held tick is the oldest missed.stop()also drops a tick fallen due and not received, so none is received after it; a period of zero or less traps; the first tick comes a period after the ticker is made; there is noreset. Why: a ticker paces work, and a backlog delivered at once to a receiver that fell behind is the opposite of pacing; afterstop, a stale tick is a surprise. Alternatives weighed: an unbounded backlog; the newest missed tick held rather than the oldest (needs a write into a value the receiver may be taking); keeping the waiting tick afterstop. -
Settled on the user’s delegation 2026-11-15 (built on branch
timing): Timed channel waits arereceive(timeout: Duration)andsend(x, timeout: Duration), overloads beside the plain forms, asFuture.await(timeout)andCondition.waitFor(timeout)are.receive(timeout)answersOption[T]:Nonefor a time that ran out and for a closed, drained channel alike (isClosed()tells them apart);send(x, timeout)answers whether it sent, and traps on a closed channel assenddoes. A timeout of zero or less istryReceive/trySend. Why: the shape ofFuture.await(timeout), and a loop over a channel’s values ends the same way whichever ended it. Alternatives weighed: a three-way result (a value, closed, timed out), heavier at every call for a distinction rarely needed; awithin:named argument (Avin overloads by type already, and no other timed wait is named so); a millisecondlongoverload (the migration below goes the other way). Proposed migration, not made here: the millisecond overloadsCondition.waitFor(timeoutMillis: long)andFuture.await(timeoutMillis: long)duplicate theirDurationforms and could be retired in a release that breaks source, their callers moved tomillis(n). -
Settled on the user’s delegation 2026-11-15 (built on branch
timing): A scope with a time limit iswithTimeout(timeout, s -> …) -> Option[T],Nonewhere the time ran out. The body runs with a new scope on a lightweight thread of its own while the caller waits in a select with anafter; when the time runs out the body’s thread is cancelled, which cancels its scope’s threads and all below them, andwithTimeoutanswers once every one has ended. A result the body returned is kept, however close to the time; a timeout of zero or less runs nothing and answersNone; nested timeouts end at the sooner time. Why:Optionis whatFuture.await(timeout)answers, and a timeout is not an error the body made; running the body on a thread of its own is what lets it be stopped wherever it is,mainincluded, whose thread no cancellation reaches, with no new runtime mechanism: a timeout is a scope’s cancellation. Its cost is that the body is on another thread:isMainThread()answersfalsethere, and a lock or a condition’s mutex the caller holds is not the body’s. Alternatives weighed:Result[T, TimedOut](a new error type for a case with nothing to say);scope(timeout = d, …)(an overload ofscopewhose result type changes with an argument); a deadline at anInstant(the wall clock moves, and a monotonic instant type does not exist yet; one could be added aswithDeadline); cancelling the calling thread itself from a timer and catching it at the timeout (a new runtime mechanism, an un-cancellablemain, and a cancellation that must tell its own timeout from an outer cancel). Review with the user: the body running on another thread is visible to code that asks which thread it is on. -
Settled on the user’s delegation 2026-11-16 (built on branch
request-context): The request context is ambient: it belongs to the running thread, not to an argument.Context.current()reads it (deadline,remaining(),value(key));withValue(key, v, body)andwithDeadline(t, s -> …)/withTimeout(d, s -> …)set it for a dynamic scope, and it is put back as the scope ends. Why: the API server and the pg driver need a deadline and request values to reach every call a request makes, and threading a parameter through every signature on the way (the explicit-argument design) taxes every library in between that does not care, and is lost the first time one forgets it; Avin already has a thread-shaped structure, the scope, that a cancellation follows down, so the context follows the same tree. Alternatives weighed: an explicitctxparameter (the tax above); a general thread-local facility (wider than needed, and a thread-local does not say what a new thread takes, which is the whole question here). The context lives in one slot of the thread’s runtime context, marked by every collection. Review with the user: ambient state is invisible at the call site, which is its point and its cost. -
Settled on the user’s delegation 2026-11-16 (built on branch
request-context): What a new thread takes follows what can cancel it. A scope’s threads (s.spawn, and awithTimeoutorwithDeadlinebody) take the whole context, deadline and values, since a cancellation of their scope reaches them. A plainspawn, a future’s code (Future(…),map,flatMap,onComplete,executor.future) and an executor’s task (execute) take the values with no deadline: nothing cancels them when it passes, so a deadline there would be a number nothing keeps; a future’s callback takes the context of the code that attached it, not of the thread that completed the future. An actor’s turn takes nothing, from the code that told it or from a worker: an actor outlives any request, and its turns are not a scope’s threads, as for cancellation. A pool worker runs between tasks with none. Alternatives weighed: everything takes everything (a deadline readable where it is never enforced,remaining()reading zero in a thread still running); nothing but a scope’s threads takes anything (a request id lost at the firstFuture); an actor’s turn taking the teller’s values (a context then travels with a message, which no other message property does). Review with the user: the actor rule means a request id does not cross atell, so tracing across actors needs it in the message. -
Settled on the user’s delegation 2026-11-16 (built on branch
request-context): A deadline is kept by cancellation, and its error iswithDeadline‘s.withDeadline(t, s -> …) -> Result[T, DeadlineExceeded]iswithTimeoutwith an instant: the body runs on a thread of its own and is cancelled when the time comes, so every existing cancellation point observes it (a socket’s accept, connect, read and write, a pool’suseandlease, a channel’s send and receive,select,sleep, a future’sawait, a safepoint poll) and no blocking call gained a new error. Its error isDeadlineExceeded(deadline: Instant), anErrorwhose message isdeadline exceeded. A nested deadline can tighten the context’s deadline and never loosen it: the context keeps the sooner one, and an outer deadline cancels an inner later one with its body. The wall clock is read once, as the scope opens; the deadline then runs on the monotonic clock, anddeadlinereports the instant asked for,remaining()the monotonic time left, never below zero. Why: a deadline is a cancellation at a time, and the cancellation machinery already reaches every wait, unwinds with deferred statements run, and gives pooled resources back;Resultbecause request code returnsResultand?s it (withTimeoutkeeps itsOption). Alternatives weighed: each blocking call checking the context and answering an error (every wait’s signature and every caller change, and code that computes is never stopped); cancelling the calling thread itself (rejected forwithTimeoutabove). Review with the user: inside the body the deadline is never an error value, it is a stop; code that must tidy up (pg sending a CancelRequest) does it in adefer, whose waits are not cancellation points. -
Settled on the user’s delegation 2026-11-16 (built on branch
request-context): Keys are typed and told apart by identity:Key[T](name).withValue[K: Sendable, T](key: Key[K], value: K, body: () -> T)takes only a value of the key’s type, andvalue[T](key: Key[T]) -> Option[T]answers that type; the value is held as anAnyand recovered by a type pattern inside the library, which reification makes exact, so no lookup casts. Two keys of one name are two keys, so a module’s values are reached by its own key alone. The value must be sendable, since the threads a scope starts read it. Alternatives weighed: string keys (a lookup that must name its type and can be wrong); keys compared by name (two modules’"id"would collide).
Higher-kinded types, inference without bounds, hole variance and hole bounds (build plan step
2, branch hkt-2)
- Settled on the user’s delegation 2026-11-15: an unbounded constructor parameter is inferred from the type an argument or the
expected type gives
F[X], named bare: a data type, class or trait with exactly as many type parameters asFhas holes, a subclass by its own name (Crate[A]passed asF[A]isCrate, not its superclass), or another constructor parameter in scope applied to as many arguments. OnceFis known, the rest of the argument is held to the type it makes with that type’s own variance, so a covariant argument still widens (both(Some(dog), Some(cat))forboth[F[_], A](x: F[A], y: F[A])takesAasAnimal, sinceOptionis covariant). A type of more parameters, of fewer, a type whose parameter takes a constructor, or one that is no data type, class or trait decides nothing and is reported as “cannot inferFfromT: …; write it, as inf[…](arguments)“, the example leaving open the arguments that match the application’s own known ones (Either[string, _]for anF[int]given anEither[string, int]), else the first ones. Why: the spec’s rule (“a type of more is an error asking forFto be written”); the example is the likeliest constructor meant. Alternatives: always leaving the first arguments open in the example (wrong forEither[string, int]); holding the arguments invariantly onceFis decided (refuses calls every instance accepts). - Settled on the user’s delegation 2026-11-15: a function’s or method’s type arguments taken as a value (
k.pick[Dog]) are held to their bounds, as at a call (a fix found in step 2: a method value checked no bound at all, so a bounded method could be instantiated at a type its bound refuses, a constructor at a hole it may not fill among them).
Higher-kinded types, constructor traits and their impls (build plan step 3, branch hkt-3)
- Settled on the user’s delegation 2026-11-15 (branch
hkt-3): a constructor trait’s default bodies are compiled once per implementing constructor: each instance of a constructor trait’s method takes the constructor after its type arguments, andSelfstands for it there (the static membersSelf.pureandF.purecome with step 5, the entry above). Why: a body shared by every conforming type seesSelfas an object, but aSelf[B]may be an option or another value laid out as no object is, and a sharedmapTwicebuilt that way crashed at run time. Alternatives: refusing default bodies in constructor traits (needlessly narrow, andMonad‘smapandmap2come from them). - Settled on the user’s delegation 2026-11-15: the methods that meet a constructor trait’s are the type’s own: those its
declaration and its impls declare, never a superclass’s. Why: the spec’s rule names “the
type’s own methods”, and a superclass’s method answers the superclass’s type, the reason a
subclass inherits no conformance. Alternatives: also meeting with inherited methods whose
results happen to fit (a
foldLeftwould; amapnever does). Review with the user if a class hierarchy wants an inheritedfoldLeftto meetFoldable. - Settled on the user’s delegation 2026-11-15: two overloads that both meet one trait method are an error at the impl, naming the method. Why: a call through the bound would have two methods to call, and choosing the more specific is a second overload resolution no call site shows. Alternatives: the more specific overload, as a written call would pick (more code, and a choice the reader cannot see); the first declared (arbitrary).
- Settled on the user’s delegation 2026-11-15: the meeting decides a method’s own type parameters from where they first appear in
its parameter types, against the trait’s, then in its result; one still undecided takes its
lower bound, and one with none is an error naming it. Every parameter and the result are then
checked with what was decided, each seen as the other’s with no conversion (a reference seen as
a supertype, as a covariant part is; never a box). Why: the spec’s “whose own type parameters
that call decides (a lower bound by its bound)”; the order makes
List‘sflatMap(f: (T) -> Iterable[U])takeUfrom the trait’sList[B]seen as anIterable. Alternatives: full inference by the call checker (heavier, and its tiers of defaults would decide what the trait’s call does not). - Settled on the user’s delegation 2026-11-15: a constructor trait requires only constructor traits, each at its own parameters
in order;
trait Shown[A]: Functor[A], Displayis an error. (Widened by the settled entry of 2026-11-14, branchhkt-7: it may also require a trait for types that bounds constructors.) Why: a trait for types bounds what a value is, and the constructor trait’sSelfis no value’s type, so what the requirement would promise is unclear. Alternatives: reading it as a bound on every applicationSelf[A](a constraint on applications, which impls over constructor parameters, step 6, are the place for). - Settled on the user’s delegation 2026-11-15: a constructor trait’s arguments are no position of a variance for the conforming
type:
List[+T]andResult[+T, +E]conform toMonad[T], an invariant parameter. Why: no value has the trait as its type, soMonad[Dog]andMonad[Animal]are never compared; the subtyping ofF[Dog]is the hole’s (F[+_]). Alternatives: none that let a covariant type conform. - Settled on the user’s delegation 2026-11-15: a class may state a conformance to a constructor trait in its header,
class Crate[A]: Functor[A], held as an impl’s is; the form leaving the trait’s arguments off is an impl’s only. A class’s methods meeting the trait’s need nooverride, and may write it. Why: a header conformance is one an impl could state, and the meeting methods are the class’s own, which override nothing. Alternatives: requiring an impl for constructor traits (no reason a header could not say the same). - Settled on the user’s delegation 2026-11-15: the conformance’s errors are reported at the impl, a meeting’s at the method where the impl declares it and at the impl otherwise: a library type’s method that does not meet is reported where the program’s impl names the trait. Why: the impl is what the program wrote; the library’s method is not the mistake.
Higher-kinded types, inferring a constructor through its bound (build plan step 4, branch
hkt-4)
- Settled on the user’s delegation 2026-11-15: the spec’s third place to look, “the one trait among those it conforms to that has
one”, is left out, since no type can reach it. An impl is never for a trait, and a trait that
requires a constructor trait is itself one, so a type conforming to it conforms to what it
requires at the same holes, as its own; a type conforming to it at fixed arguments
(
class Digits: Bag[int]) is refused at the declaration. A type is therefore matched as itself, then as its superclasses nearest first, and a type with no conformance there is an error naming the bound and the type. Why: code for a case no program can write would be untested. Review with the user: it returns, with its “several such traits” error, if traits come to implement constructor traits by impls (impl Monad for Seq), which the spec’spairUp[Seq, …]example presumes and the library step will want. - Settled on the user’s delegation 2026-11-15: with several constructor-trait bounds, each conformance the type (or the superclass
matched) has decides; two that leave different arguments open are an error naming both
(
PairimplementsMappableasPair[int, _]andLeftyasPair[_, int]), and a bound the type lacks is reported as for a written constructor. Why: the bounds are one demand on one constructor, so the nearest type with any of them is the answer the others are checked against. Alternatives: the first bound written decides (order-dependent); the nearest type with all of them (skips a subclass’s own conformance for a superclass’s, which the spec’s no-inheritance rule forbids). - Settled on the user’s delegation 2026-11-15: an argument written out of a constructor joins only where the type’s parameter is
covariant and the argument a reference type known at that argument; the expected type, checked
first, fixes it.
second(dogs, cats)makesFResult[_, Animal]; withval r: Result[int, Dog] = second(dogs, cats)the expected type has madeFResult[_, Dog]and the cats are refused. Why: the expected type decides type arguments before the arguments do for every generic call. An argument the first argument leaves unknown (Ok(1)‘s error type) is decided by the next, as an invariant one is. - Settled on the user’s delegation 2026-11-15: inference sees a subclass as its superclass, or a type as a trait, only where a value
is read out (a fix found in step 4, which matching through a superclass’s conformance meets):
at an invariant argument or a function’s parameter, inference held a
Box[TallShelf[int]]to be aBox[Shelf[A]], and a(Dog) -> intan(Animal) -> B, so generic code could store aShelfin the box or pass a cat to the function, reading memory that was never aTallShelf‘s or aDog‘s. Both are now refused; a type that is the class itself is still taken there.
Higher-kinded types, static members on constructors (build plan step 5, branch hkt-5)
- Settled on the user’s delegation 2026-11-15: a constructor named bare, or with
_for the arguments it leaves open, has as its static members those of the constructor traits it implements at exactly those holes, each conformance held as a constructor argument’s is (the holes the impl leaves open, the arguments written out meeting the impl’s bounds):Option.pure,Result[_, E].pure,Parsed.purefor an alias that is a constructor, andBox[_].pure, the same asBox.Result[int, _].pureis an error sayingResultimplements the trait asResult[_, E]. Why: a static member of a constructor trait names no parameter of the trait, so the constructor is all a call needs, and the conformance says which constructor it is. Alternatives: look the member up on the type at any arguments (would letResult[int, _]reach a member of the conformance at the other hole). - Settled on the user’s delegation 2026-11-15: a static member of a type’s own conformance to an ordinary trait is not reached on
the type named bare:
Box.make()forimpl[T] Make for Box[T]is an error asking for the type arguments (Box[A].make(…)), as before. Why: that member’s types name the type’s parameters, which a bare name leaves unknown. Alternative weighed: inferring them from the call as a generic function’s are (a separate feature, not part of constructors). - Settled on the user’s delegation 2026-11-15: a constructor trait’s static member still takes no default body, as every trait’s
static member does: defaults that call
Self.pureare its methods’. Why: the rule for static members is one rule for every trait; the per-constructor compilation would allow it, so it can be added later without changing anything written now. Review with the user if the library wants a derived static member (aMonad.unitfrompure). - Settled on the user’s delegation 2026-11-15: two bounds that each declare a static member of one name and parameter types make a call of it on the parameter ambiguous, by the ordinary overloading rule, rather than one bound being preferred. Why: nothing says which constructor’s member is meant beyond the bounds.
- Settled on the user’s delegation 2026-11-15: a static member called on a value of
F[X]is an error pointing atF.pure(…); on a value of a known type,Some(1).pure(2), the existing message names the type. Why: the member is the constructor’s, and the constructor is what the call writes. - In each instance a static member called on a constructor is compiled once per constructor: the
type’s own member at
Nothingfor the holes, which it never names, soOption.pureandF.pureatOptionare one instance.
Higher-kinded types, impls over constructor parameters (build plan step 6, branch hkt-6)
-
Settled on the user’s delegation 2026-11-15: an impl adding to
F[A]belongs to the trait boundingF: written in the module of one ofF‘s bounds (or in the core library) it is that trait’s own and seen everywhere, and written anywhere else it is an extension. WithF[G[A]]it isF‘s bounds, the head’s, that count. Why: such an impl adds to every type the bound’s conformance reaches, asimpl[T] Seq[T]adds to every sequence, and that impl’s home is the trait’s module. Alternatives: always an extension (would make the library’s ownimpl[F[_]: Monad, A] F[A]need an import of its own module); any module of any bound named in the impl (blurs which module owns it). -
Settled on the user’s delegation 2026-11-15: such methods are found after the type’s own, wherever the impl is written: a type’s own method, or the bound’s, of the name and parameter types is called, and a call that sees only the bound, in generic code, calls the added one. Why: the impl adds to a family of types as an impl adding to a trait does, and that is the trait rule; the rule for impls adding to one type built from parameters, which makes a clash with the type’s own method ambiguous, would make every type that has, say, its own
twiceunusable once the library adds one. An extension adding a method the bound already declares is an error where it is declared (maponMappable). -
Settled on the user’s delegation 2026-11-15: the constructor parameter need not be bounded: unbounded,
Fis matched as inference matches it without a bound, a type of exactly as many arguments asFhas holes, named bare. Why: it is the inference rule, unchanged, and refusing it would add a rule; such an impl’s methods reach nothing ofF[A]but can pass it on. Alternative: require a constructor trait bound (an error naming the bound to add). Review with the user if the unbounded form should rather be an error. -
Settled on the user’s delegation 2026-11-15: a receiver whose type no such impl matches is told why:
twiceon aPlain[int]says the method is forF[A]whereFimplementsMappableand thatPlaindoes not implement it, the reason inference gives; anF[int]whoseFlacks the bound says its constructor is bounded by noPointed. Of several such impls adding the name, only one is named, since every generic type is an instance of each; an impl adding to a type the receiver is an instance of,Option[Option[T]], is named first. -
Settled on the user’s delegation 2026-11-15: a function value of an extension method the file does not see, or of a private added method, is reported as a call of it is (“
shoutis added tostringby moduleextras, which this file does not import”), where it said only that the type has no member. This holds for every extension, not only those over constructor parameters. -
No impl of a trait is for
F[A]: a conformance is a type’s, stated once for it, and an application of a constructor parameter is no type of its own. The impl declares no static member, as no impl adding to a type built from parameters does. -
Settled on the user’s delegation 2026-11-15 (built on branch
rendezvous): a rendezvous isChannel[T](0), and a channel with no capacity stays unbounded through a default ofunbounded, a publicvalinavin.threadsholding the largestint. This replaces the settled “unbounded at zero”. Why: zero is the capacity that holds nothing, so reading it as a hand-off says what it is;Channel[T]()keeps its meaning, so no program changes (none in the tree passed0); and an unbounded channel is the bounded one at a bound it can never reach, so it needs no case of its own. Alternatives weighed: keeping zero unbounded and addingChannel.rendezvous[T]()or arendezvousflag (a second spelling of capacity, and zero would still read wrongly);capacity: Option[int] = None(every bounded channel would writeSome(n)); a negative sentinel such as-1for unbounded (a capacity that is not one, and a negative one traps). Review with the user: it changes what an explicitChannel[T](0)means, from unbounded to a rendezvous. -
Settled on the user’s delegation 2026-11-15 (built on branch
rendezvous): a rendezvous hands values to waiting parties directly, and a select’s arm is a party that a partner claims. A plain sender or receiver waits on a condition of its own until a partner completes it; a select’s arm on a rendezvous stands on the channel while it waits, and a partner completes the arm only by first ending the select’s wait through that arm (select_claiminruntime/avin/rt/select.sysl), so no select runs two arms. A select can be claimed only once every arm of its round is tried and enlisted; a partner that meets one still trying its arms wakes it (a poke), and the select, trying that arm again, waits out a partner select still mid-round rather than missing it. Why: it keeps the one-lock-at-a-time select of buffered channels, and the claim is the one atomic step that decides an arm. The receiver “has the value” once a sender completes it, so a receiver cancelled after that stops with the value. Alternatives weighed: a sender depositing its value and waiting for it to be taken (a select’s send arm cannot deposit without committing to it); locking every channel of a select at once (a lock order across channels, and a different design for every select). The sender’s wait is its own kind in the thread dump and deadlock report, “waiting to hand a value to a receiver”. -
Settled on the user’s delegation 2026-11-15 (built on branch
hkt-9): a diagnostic’s article follows how a type’s name is read. A capital letter standing alone at the start of a name (F[int],T,X2) is read as the letter, so it takesanbefore A, E, F, H, I, L, M, N, O, R, S and X andaotherwise (an F[int],a T,a U); any other name takesanbefore a, e, i, o in either case andabeforeu(a unit,a usize,a Unicorn), one helper (articleincheck.sysl) for every message. Why: constructor and type parameters are single letters, and “aF[int]“ read wrongly; the type names that begin withumostly sound a consonant. Alternatives weighed: treatinguas a vowel, as three of the four old helpers did (“anunit“); reading every all-capital name as letters (an HTTP, buta NASAreads as a word, and no type name in the library is one). -
Settled on the user’s delegation 2026-11-15 (built on branch
c-void-ptr): a C binding’svoid *orconst void *parameter takes an array of any element type an array crosses as, or aByteBlock, and its length counts bytes. The array’s elements go to C where they are, as for a typed pointer, with no element type checked against the header (there is none to check); the parameter markedlength(p)is told the array’s length times its element size, along, and aninoutlength C writes back is bytes too, bounded by the array’s bytes.None, or the wordnull, passes null. C writes throughvoid *and only reads throughconst void *. Still refused:outorinouton avoid *(C writes no value of a type through one), avoid *result other than one discarded by aunitbinding, and an array whose length no parameter carries, somemcmp‘s second pointer is refused. Why: the gap was met by marshal’ssysctlbyname, the shape of the C library’s every untyped buffer (read,write,getentropy,sysctl); an array and a block are already the binding layer’s memory, so this adds no new kind of value, only drops the element check, and counting bytes is what every such C function means by its length. Alternatives weighed: anArray[byte]only, decoded in Avin (sound, but reading anintor alongwould need a byte decoder in every program, and no such helper exists);out int *pwritten in the prototype where the header saysvoid *(breaks the rule that a prototype is the header’s, and needs a size for the length); a length in elements (wrong for everyvoid *function, which counts bytes); a sharedlength(a, b)formemcmp-shaped functions (useful, but a separate feature). Review with the user: whether a shared length is wanted, and whether a callback’sconst void *should lend aByteView, which is still refused. -
Settled on the user’s delegation 2026-11-15 (built on branch
c-opaque-errno): a pointer to an opaque pointer is memory of no type:void **, and a pointer to a typedef the headers makevoid *orconst void *(rusage_info_t *), take whatvoid *takes, their length in bytes; C fills an array throughout void *orout T *withTsuch a typedef, itslength:counting bytes, rounded up to whole elements, the rest zero; and C fills a struct mirror throughout void *,out void **or a pointer to a typedef. The prototype is still the header’s:rusage_info_t *, held to the header exactly. Only the headers say what a typedef is, so the C unit checks an array’s elements through a pointer to a typedef as the typedef’s elements or the typedef beingvoid *, and measures which, beside the integer measurements, for lowering to count the length in bytes or in elements; a mirror’s typedef is checked to be its struct orvoid *. Memory of no type C allocates (out void **witharray:orbytes:) is anArray[byte], since its length in bytes need not be a whole number of wider elements, and copying a rounded-up count would read past C’s allocation. Why: marshal’sproc_pid_rusageneeded a process’s physical footprint, and every form it tried was refused; the typedef’s kind is decided where the spec decides every typedef’s, by the Avin type and the C unit’s check.length:counts bytes for memory of no type aslength(p)does, sosizeof(struct rusage_info_v2)is written as the header says it. Alternatives weighed: a word in the prototype marking the pointer untyped, or a cast ((void *) rusage_info_t *buffer), which the C unit’s measurement makes unnecessary; alength:in elements for memory C fills (consistent with typed arrays, but the binding would divide the struct’s size itself); a mirror field for a fixed array (uint8_t ri_uuid[16]), which would make the struct mirrorable, left for when a program needs a field after one rather than the array form. Review with the user: fixed-array fields in struct mirrors. -
Settled on the user’s delegation 2026-11-15 (built on branch
c-opaque-errno): a binding markederrnoanswersErroferrnowhere C answers -1,Result[T, Errno]orResult[T, <integer>], itsOksplit as a result that is not a status is (the C result kept as an integer or left out, then the out values). The bare word followsblocking‘s form.errnois read by the C unit’s glue straight after the call, written through a pointer the binding passes after the arrays’ lengths, so nothing — alength:expression, ablockingcall’s return to the scheduler, a collection — runs between the call and the read; the binding is always called through glue. The failure is the -1, noterrno(a function may seterrnoand succeed); a C result of an unsigned type fails at all ones.avin.c.Errnois a data type of the standard library with a case per POSIX error number both macOS and Linux define, named as C names them (ESRCH,ENOENT), andOther(code); itsmessageis the number’s sentence, the same on every platform. The C unit measures each case’s value by its macro (<errno.h>is included for a program with anerrnobinding), and lowering compares the number against them. Why: the C bindings’ first decisions named anerrnoflag answeringResult[T, int]from a-1result as the likely form; named cases let a program matchErr(ESRCH)without knowing a platform’s numbers, and C’s own names are what a reader of a man page looks for. Alternatives weighed: mapping toio.IoError(losesESRCHandEPERM, which it has no kinds for); an enum mirror in the library (needs a C unit for every program and traps on a number no variant holds); PascalCase descriptive names (NoSuchProcess), which a man page does not use; a null pointer result as the failure too (not built: a handle or string answered witherrnois still refused, the C result being an integer). Review with the user: the C names as variant names, anderrnoon pointer results. -
Settled on the user’s delegation 2026-11-15 (built on branch
c-opaque-errno):avin checkbuilds the C unit, revisingcheck-stops-early(2026-11-06) for C: a binding the headers refuse (a prototype the header contradicts, an array’s elements, a typedef’s kind, a constant) is refused bycheckas bybuild,runandtest. Why: marshal met a bindingcheckpassed andtestrefused; the C unit is one clang compile, cached by its source’s hash, far cheaper than the shims and the loweringcheckgave up, and only C bindings make one. The Sysl shims stay behind--bindings. Alternatives weighed: keepingchecksilent and documenting it (the disagreement marshal met); moving the checks into the checker (impossible: only the headers know a typedef). -
Settled on the user’s delegation 2026-11-15 (built on branch
test-orphans): a programavin runoravin teststarts watches its runner and ends when the runner does, even one killed withSIGKILL; andavin runcontains its program too, closing the known limit ofrunner-orphans(2026-11-12). The runner names itself inAVIN_RUNNER_PID; the runtime, as a program starts, takes the variable out of its environment and, only when the process it names is the program’s parent, starts a thread that waits for that process to exit (a kqueueEVFILT_PROC/NOTE_EXITon macOS; elsewhere a check of the parent every 100 ms). When the runner is gone the program sets its ownSIGTERMaside, sendsSIGTERMto the group it leads (or to itself when it leads none), waits 200 ms, and sendsSIGKILL. A program started any other way, or with the variable naming a process that is not its parent, watches nothing.avin runstarted away from a terminal now starts its program as the leader of a group of its own, passesSIGTERM,SIGINTandSIGHUPon to the group, kills it 2 s after the first if it is still running, exits with the program’s status, and stops whatever is left of the group once the program has ended. Started at a terminal as its foreground job,avin runkeeps the program in that job, so the terminal’s Ctrl-C and Ctrl-Z and the shell’s job control reach both as before; it passes onSIGTERMandSIGHUPto the program alone and lets the program decide what Ctrl-C means. Why: four test programs of 0.0.21 runs were found alive after 37 h at PPID 1, one still holding a port another project’s tests then collided with: runners killed outright (a deadline, a stopped agent) cannot act, andavin rundid not contain its program at all. Alternatives weighed: a thread in every program that polls its parent (a cost for programs nobody runs under a runner, and on macOS a kqueue waits for free); Linux’sPR_SET_PDEATHSIG(fires when the parent thread that started the child ends, and runners start programs from worker threads; macOS has none); keeping the terminal case in a group of its own given the terminal (foreground), which would leave a Ctrl-Z stopping the program alone whileavin runwaits for it, wedging the shell; a longer grace for the watch (the runner that would have waited is gone). Known limits: at a terminal, a program’s own children are not reached whenavin runis killed outright, only the program; a program that ignores the runner’s death by leaving its group or session is beyond reach. Review with the user: the terminal case keeping the program in the shell’s job. -
Settled on the user’s delegation 2026-11-15 (built on branch
api-observe): a request knows its client’s address and its route (system library).ServerRequestgainsremote(the peer’s IP address, numeric, without its port) androute(the pattern of the route a router chose, set byRouteras it binds the parameters), andByteStreamgainsremoteAddress,Noneby default, whichTcpStream(accepted and connected) andTlsStreamanswer. Why: a rate limiter keys by client by default and a metric labels by route; a path as a label would grow without bound, and the address was being dropped ataccept. The address is without its port, since a client opens many connections and is one client. Alternatives weighed: wrappingRoutes in a metrics-specific function that knows each pattern (no help for the access log or a program’s own middleware); taking the address fromX-Forwarded-For(anyone can send it; a program behind a proxy gives the limiter akeythat reads it). Review with the user: whetherremoteshould also carry the port. -
Settled on the user’s delegation 2026-11-15 (built on branch
api-observe): the access log.http.accessLog(sink, format, clock, ids)is a middleware, writing after the handler answers, in two formats,PlainLinesandJsonLines, with method, decoded path (escaped so the line stays one line of fields), status, body length, duration, request id and address. No timestamp: whatever collects standard error stamps lines, and a test’s lines stay fixed. The query is left out, as it can hold secrets. A client’sX-Request-Idis kept when it is 1 to 128 characters of letters, digits and-._:+/=@, else replaced by 16SecureRandombytes in hex; the handler reads it from the request’s own header, whichwithHeaderReplacedsets, and the response echoes it unless the handler set one. A streamed body of unknown length logs-/nulland not the bytes written, since the line is written when the handler returns, before the body is. Alternatives weighed: a common/combined log format (no request id, timestamp in brackets, request line quoted with the query); counting a streamed body as it is written (the line would wait for the stream to end); a request-scoped value in place of the header (that mechanism is a separate branch,api-request-values; the header is what clients and proxies already read). Review with the user: a handler that traps writes no line, since Avin has no unwinding; logging the server’s500would need a hook inserve. -
Settled on the user’s delegation 2026-11-15 (built on branch
api-observe): request metrics.Metricsholds per-(method, route, status class) counters and per-(method, route) histograms of fixed buckets in oneMutex, plus an atomic in-flight gauge, rendered as Prometheus text format 0.0.4 with the nameshttp_requests_total,http_request_duration_secondsandhttp_requests_in_flight; times are whole microseconds, written as seconds without trailing zeros. Default buckets are the usual 5 ms to 10 s. A request with no route is labelled"". Why: one lock perMetricsis simple and exact, and a request does a few map updates under it; the format is what every scraper reads. Alternatives weighed: per-route atomics (route series are created on demand, so a map and a lock are still needed); a metrics registry of general counters and gauges (more than this item needs;observecovers counting another way); labelling by status code rather than class (more series for little gain). Review with the user: a handler that traps leaves the in-flight gauge one too high, for the same lack of unwinding. -
Settled on the user’s delegation 2026-11-15 (built on branch
api-observe): rate limiting.RateLimiter(rate, per, burst, key, maxKeys, clock, errors)is a token bucket per key, computed as each bucket’s next-token time in integer microseconds (the generic cell rate algorithm, exactly a token bucket), so a bucket is onelongand needs no floating point. A full bucket equals a new one, so forgetting it loses nothing; atmaxKeys, making a bucket forgets every full one, or where none is full the one nearest to full. A429carriesRetry-Afterin whole seconds, rounded up and at least one. Alternatives weighed: refusing a new key when the table is full (a flood of addresses would lock every new client out); a periodic sweep on a timer thread (a thread per limiter; sweeping when room is needed bounds memory the same); a sliding-window counter (less smooth, more state). Review with the user: evicting a bucket that is not full forgives that client’s debt, which an attacker cycling more thanmaxKeysaddresses can use; and the default key, the client’s address, puts every client behind one proxy in one bucket. -
Settled on the user’s delegation 2026-11-23 (built on branch
http-cors): CORS middleware.Cors(origins, allowOrigin, methods, headers, exposed, credentials, maxAge)with amiddleware. Origins match exactly (a browser’s origin is serialized in lower case, and its own check is exact);*with credentials traps at construction; with credentials the origin is echoed, never*, andVary: Originis merged into the handler’s. A preflight is always answered204by the middleware, granting nothing (no CORS header) for an origin, method or header not allowed, which is how a browser is told to refuse; emptyheadersreflects the requested ones. Defaults are the safe ones: methodsGET, HEAD, POST, no credentials, no max age. A disallowed origin’s actual request is still handled (it carriesVary: Originso a cache keeps the answers apart). Alternatives weighed: forwarding a disallowed origin’s preflight to the handler (the handler would answer a route’s405, a confusing signal and extra work); case-insensitive origin matching (not what a browser does); a wildcard that echoes with credentials (the Fetch standard forbids*there, and an echo of any origin with credentials is an open door, soallowOriginmust be asked for). Review with the user: emptyheadersreflecting any requested header is the common default but allows more than a closed list would. -
Settled on the user’s delegation 2026-11-15 (built on branch
resolve-blocking): which library bindings are blocking. Name resolution (sysl.net.resolve, whichTcpStream.connectcalls; since 2026-11-16 made on a helper thread instead, below) and connecting a Unix socket are, as are reading, writing and opening a file inavin.fsandavin.process‘s redirections (the whole-file calls,File‘sread,writeandflush, and every open), and reading a time zone’s file: each can wait on a pipe, a FIFO, a device or the network. Asking about a path, listing a directory, creating, removing and renaming entries are not, nor are closing a file, spawning a process, reading the OS’s entropy or the in-memory TLS engine. A test inshim_tests.syslnames each waiting binding a program reaches and asserts it blocking. Alternatives weighed: binding every file-system call blocking (the metadata calls do not wait on another party, and each blocking call is copied across); only the calls that touch the network (a FIFO open or read held its worker and every collection, whichtests/run/fs_fifo_blocking.avinshows). Review with the user: a directory operation on a network file system can also wait, and standard input and output, which the runtime reads and writes through intrinsics rather than bindings, are not yet safe for the collector while they wait. -
Settled on the user’s delegation 2026-11-16 (built on branch
resolve-cancel): a host-name lookup is a cancellation point. As a blocking call it was not: awithTimeoutwaits for what it cancelled to end, so a slow resolver held a connect’s time limit past its deadline (a 100 mswithTimeoutaround a connect whose lookup took 3 s answered after 3009 ms). The runtime (runtime/avin/rt/lookup.sysl) makes each lookup on a helper thread and the caller waits for a byte on a pipe as it waits on a socket, so a cancellation ends the wait at once; an abandoned lookup runs on to the resolver’s answer, which its helper throws away before closing the pipe. The host, port and answer are copied into a slot and out again under one lock, so nothing either thread holds is shared. Helpers are detached, take the oldest queued lookup, and end once none is queued; at most 64 run at once, which bounds how many abandoned lookups can still be running. Past the bound a new lookup waits in the queue, and a cancellation drops it from there. A numeric address is resolved inline. A lightweight thread waiting on a lookup shows in a thread dump as “looking up a host name”. Tests hold the helpers through a runtime hook (resolve_hold), since no resolver that never answers can be stood up without system configuration on every platform. Alternatives weighed: one detached thread per lookup with no bound (abandoned threads pile up without limit while the resolver is down); failing a lookup at once past the bound (fails lookups of hosts that would answer); the platform’s asynchronous resolver (getaddrinfo_ais glibc’s alone, and macOS’s is a different API); a resolver of Avin’s own speaking DNS (loses/etc/hosts, NSS and the system’s configuration). Review with the user: whether lookups of the same host and port in flight at once should share one helper, which would keep repeated retries during a resolver outage from filling the 64. -
Settled on the user’s delegation 2026-11-17 (built on branch
byte-writer, for the PostgreSQL package’sCOPY … TO STDOUT):avin.io.ByteWriteris the byte sink besideReader(ByteWriter): one method,write(bytes: Array[byte]) -> Result[unit, IoError], writing all ofbytes.fs.File, everynet.ByteStream(TcpStream,UnixStream,TlsStream),net.StreamWriterandhttp.BodyWriterimplement it by thewritethey already had, so no call changes;ByteStreamandStreamWriternow takewritefrom the trait instead of declaring it. The name: the pair ofReaderwould beWriter, but the prelude’sWriter(module avin, seen by every program unqualified) is the text sink values render into, soavin.io.Writerwould makeWritermean two things in any program importing it, andDisplay‘sdisplay(out: Writer, …)would read as the wrong one. Alternatives weighed:Write(a verb, asCloseis; butavin.netalready has aWritecase of how a socket is shut down, andWrite/Writerside by side invite the wrong one);Sink(short, butavin.io‘sSourceis a TEXT source, soSinkreads as its text pair);Output(says nothing of bytes, and reads as a command’s output);ByteSink.ByteWritersays what it takes and pairs withByteStream. Noflush(): files buffer and sockets do not, so a flush on the trait would be a no-op for most implementations, and TLS keeps a privateflushof its own that a public one would collide with; whoever opened a file closes it, which flushes. Not aClose, asReaderis not: aBodyWriteris ended by its response, not closed; code holding a resource that is both bounds it by both.io.copy(from: Reader, to: ByteWriter) -> Result[long, IoError]copies in pieces of at most 64 KiB, answering the count or the firstErr, closing, flushing and rewinding nothing. Standard output and standard error stay text-onlyWriters: they have no byte path to write through. No in-memory byte sink is added: aBuffer[byte]is filled byaddAll, and a sink of the program’s own is a five-line class. Review with the user: the nameByteWriter(againstWriteorSink), and whether standard output should gain a byte path and be aByteWritertoo. -
Settled on the user’s delegation 2026-11-17 (built on branch
cbind-gaps, for the libssh2 binding): a function pointer markednullis passed null (C bindings).libssh2_session_init_exis the only way to make a session (libssh2_session_init()is a macro passing four nulls), and a function pointer without auserdatawas refused with no way to pass null. The prototype wordnull, which already passed null for any other pointer, now takes a function pointer too; its parameters are read only as C’s types for the header check (named, nouserdataorlength, any result), since C never calls it. Refused:nulltwice, afterout, on a struct by value or a scalar, and an unnamed function pointer. Alternatives: anOption[function]parameter with onlyNonelegal (a parameter whose one value is written at every call, and anOptionthat never holdsSome); binding a header macro (libssh2_session_init), which the C unit cannot type-check as a function and which most hooks have no macro for. -
Settled on the user’s delegation 2026-11-17 (built on branch
cbind-gaps): a kept handle no C reference can hold is kept from the collector until its holder’sreleasehas run (C bindings). libssh2 counts no references, frees every channel inlibssh2_session_free, and reaches the session fromlibssh2_channel_free; a channel and its session found dead in one collection were finalized in address order, so the session could go first and the channel’s release free it again.kept:may now name a class with noretain(or with akept:of its own): the holder pins the kept handle’s Avin object in a runtime table, a root of every collection, and lets go of the pin after its ownrelease, byclose()or its finalizer; the kept one is finalized in a later collection. Itskept:name is the kept handle’s pointer, or null once that handle was closed, so the release can tell (session ? libssh2_channel_free(self) : 0). A chain is finalized one link per collection, holder first. A cycle through a pin is never collected (a session keeping, as its Avin object, a channel that pins it): both are given back once either is closed. Why: the collector finalizes in address order and a finalizer cannot resurrect, so ordering can only come from keeping the kept object reachable until the holder is done; a root held per holder does that with no change to the collector. Alternatives: collector-ordered finalization (topological, as some collectors offer; the gc library has none, and Avin does not change it); the holder’s release given back without its kept object, on trust (the unsound state this replaces); aretain:of the package’s own (libssh2 has no count to take). Review with the user: that a cycle through a pin leaks until closed, rather than being refused. -
Settled on the user’s delegation 2026-11-17 (built on branch
cbind-gaps): a handle holds C integers for itsrelease:,holds:on the class andhold:on a binding (C bindings). libssh2 is given the socket of an AvinTcpStreamand writes to it inlibssh2_session_free; a stream finalized first, or closed by the program first, gives its descriptor’s number to the next one opened, so the session’s farewell could reach an unrelated connection, and a release that sees onlyselfcannot say which socket it used. A class declaresholds: "int sock = -1", a C declaration of an integer and the value it starts as; a binding’shold: "sock"makes the handle it answers, or its receiver, hold the value of that integer parameter when the call succeeds, replacing one held before; the release uses it by name. The value is an entry on the list the glue keeps of what the handle holds, beside its C references, so the layout of a handle does not change. The package holds a descriptor of its own,duped from the stream’s, which makes the session’s release sound whichever object the collector finalizes first and whether the stream was closed before. Refused:holds:on asharedclass or one withretain:(one reference of many), a namerelease:does not use,selfor thekept:name, a declaration that is no integer;hold:naming no integer parameter, or a name the holder’s class does not declare, or on a binding answering no handle and no method of one. Alternatives: the kept stream pinned until the session’s release, as kept handles now are (the release still could not read the descriptor from an Avin object, finalizers running no Avin code, and a stream the program closed first would hand the release a number already reused); holding the stream’s own descriptor withoutdup(the same reuse); a C handle over the descriptor (a handle is on a pointer). Review with the user: whetherholds:should also take pointers. -
Settled on the user’s delegation 2026-11-17 (built on branch
cbind-gaps):free:frees a string C answers through anoutpointer by an entry"name: how"(C bindings).libssh2_channel_get_exit_signalanswers three strings freed bylibssh2_free(session, p), andfree:covered only a result.howis a C function of the string or a C expression in its name, compiled in a glue function per string that a method passes its receiver’s object: the expression may useself, the receiver class’skept:name and the values itholds:(here the channel’s kept session). It is called once the copy is made, never for null, and on a failed status for each string C answered, unread. Refused: a name that is nooutparameter answering a string or its bytes,inout(C may answer the copy it was passed), a name freed twice, an expression not in the name, and named entries beside arraysarray:frees by position. Why the spelling:free:already says how what C answers is freed, andname:reads as thekept: "face: Face"entries do; a name is needed because a binding answers several strings. Alternatives: a separate key (frees:), a second word for one idea; any parameter of the call in the expression (the strings C was passed are freed once converted, before the outs are, so only the receiver’s own names are offered); copying the string in the call’s glue and freeing it there (a second copy of every string). -
Settled on the user’s delegation 2026-11-17 (built on branch
pool-check-cancel, for the PostgreSQL package’s pool under deadlines): aPoolcall cancelled whilevalidatechecks a resource puts the resource back as one given back is put back (Pool): idle, or to the first call waiting, destroyed only where the pool was closed meanwhile or the resource has outlivedmaxLifetime. It was destroyed. A deadline (withDeadline,withTimeout) cancels a thread, and a function entry or a loop’s back edge is a cancellation point, so a deadline passing just as an idle resource was taken stopped its check even wherevalidatenever waits, and good resources were destroyed: up to 5 of a pool of 4 in a round of 100 calls under short deadlines. Why it is sound: every resource is checked before it is lent, one handed to a waiter included, so one a stopped check left in a bad state (a ping half sent) is caught and destroyed at its next lend. Alternatives weighed: runningvalidatewhere cancellation cannot stop it (a check that blocks, a ping to a server that does not answer, would then hold the caller past its own deadline until the check’s own timeout); destroying the resource only wherevalidatehad begun to wait (the pool cannot see inside the check, and a resource cut off mid-exchange is caught at its next check either way). Of the pool’s other cancellable steps, a cancelledcreatealready gives its place up, or keeps what it made, and a cancelledfalready gives the resource back; destroying outlived and closed resources runs where nothing stops it. -
Settled on the user’s delegation 2026-11-18 (built on branch
static-link, for tend’s one self-contained binary): a program links its C libraries from their static archives when its manifest saysstatic-c-libraries = true(C bindings). The user decided that static linking is avin’s own item; the shape is this branch’s. One top-level key of the root package, a boolean; a dependency’s is not read, since how a program is linked is decided once for the whole of it, and a library package deciding it would decide for programs it never sees (Sysl’slinkkey, root-only for the same reason). For every library apkg-configmodule finds, of every package in the program, the build askspkg-config --static --libs, which adds what the library links privately (Libs.private), and replaces each-l<name>whoselib<name>.ais in one of the answer’s-Ldirectories by the archive’s path, the only spelling that reaches an archive on macOS, where the linker takes a.dylibover a.ain the same directory. A name none of those directories holds is the system’s own (libSystem, libz) and stays dynamic. A name whose shared library is in one of them but whose archive is in none stops the build with an error naming the shared library and the archive it lacks, where Sysl’slink = "static"links such a library dynamically and says so only under--verbose: a program asking for static libraries exists so that the machine running it needs nothing installed, and a silent.dylibis the very program the key is there to prevent. A library named bylinkis passed as-las before. Alternatives weighed: a per-librarystatic = trueinc-libraries(the library’s author would decide for every program, and a program could not ask for a dependency’s library); Sysl’slink = "static" | [names]with a--linkflag (a top-levellinkbeside thelinkof a C library meaning-lnames would read as one key with two meanings; a list of names and a flag can come later without changing this one); a--static-libsbuild flag alone (how the program must be linked is a property of the program, and a release built without the flag would quietly need Homebrew). Review with the user: the key’s name and its boolean shape against Sysl’slink; that it is stricter than Sysl’s"static"; that a librarypkg-configgives no-Ldirectory for counts as the system’s, which on Linux leaves a distribution’s/usr/liblibraries dynamic; and that the C libraries of a program’s Sysl packages (requires { pkg_config }) are not covered. -
Settled on the user’s delegation 2026-11-18 (branch
contra-infer): inference holds an argument to its parameter by each type argument’s variance, and a type argument named at a contravariant argument is decided as the type given there.take[T](b: Box[B, T])forBox[-I, +T]accepts aBox[A, int]whereBis anAand takesTasint, as the non-generictakeInt(b: Box[B, int])always did; the same holds for a function type’s parameters ((A) -> intgiven for(B) -> T) and a constructor parameter’s contravariant hole.feed[T](b: Box[T, int], x: T)given aBox[A, int]takesTasA, the largest type the box accepts, and a later argument must be an instance of it; an earlier argument that widenedTbeyond it is an error. Why: the spec says constraints are subtype constraints, and the checker unified a contravariant argument for equality, refusing calls the same signature accepts without type parameters (it blocked the parsing library’sRule[-I, +T]). Alternatives weighed: collecting upper bounds and solving to their meet, so two boxes ofAs and ofBs given for oneBox[T, int]in either order takeB(more complete, but needs a meet the checker has nowhere else; with the order as written the box ofBs first is accepted today, the other order is refused); deciding such a type argument from the other arguments only (would refuse the probe above wheneverTis named nowhere else). A type argument named at a contravariant argument nested in another contravariant one is still held whole. Review with the user: whether the meet is worth adding when a program meets the order-dependent case. -
Settled on the user’s delegation 2026-11-18 (branch
stdin-serialize): threads read standard input one at a time, and each read is whole (system library). AreadLine, an iterator’s step, a character andreadAlleach hold the input from their look at whether it has ended to their taking of what they read, so a line goes to exactly one reader, never split between two or given to both, and a reader past the end getsNone, never a stray empty line. Found because nothing serialized the one buffer: two lightweight threads reading at once hung (both parked on the descriptor) or trapped out of range in the runtime. The lock is a runtime lock of the library’s kind (ParkLock, held across the reader’s wait for input): a lightweight thread waiting for it, or waiting for input while holding it, parks, so neither holds up a carrier; it is a region a trap is not contained in, as any lock’s is, so a contained trap never leaves it held. An iterator over standard input takes the line (or character)hasNextanswers for and keeps it untilnext, since otherwise another thread could take that line between the two andnextwould fail on ahasNextthat saidtrue. On one thread this is seen only by code that askshasNextand then reads by another way: the other read gets the line after the one the iterator holds. Alone, a reader pays two uncontended lock operations per read (2M lines: 0.136 s before, 0.139 s after). Alternatives weighed: a lock taken inside each runtime call only (the library’s look at the end and its take are two calls, so a reader could still getSome("")past the end); an OS lock (held across the wait for input it would block a carrier, and a thread parked holding it would resume on another carrier and let go of a lock it does not own there); aMutexinavin.io(the same lock, with an object to keep alive and the module made to depend onavin.threads); an iterator whosehasNexttakes nothing (racy across threads, as above). Review with the user: the iterator’s taking of its line athasNext. -
Settled on the user’s delegation 2026-11-18 (built on branch
typaram-bound, for the parsing library’sRule[-I: Reader, +T]): a function’s or a method’s own type parameter may be bounded by a type parameter declared before it,[J: I](generics), the twin of the lower bound[W >: T]. AJis anIwith no conversion and hasI‘s bounds; each type argument must be the bounding one’s or be seen as it as a covariant part is (so a value type never stands for a trait there); the bound is a position where a value is passed in, so a-Imay bound one and a+Tmay not; an override writes the overridden method’s bound or none. Choices this branch made: only a function’s or a method’s own parameters take one, as only they take a lower bound (a type’s own[A, B: A]would need its own variance rule, the opposite of a method’s, and no program needs it yet); the bounding parameter is declared before it (the enclosing type’s or impl’s, or earlier in the list), which rules out cycles by construction and makes[A: B, B: A]an error at its first bound, where lower bounds allow a later parameter and check for a chain leading back; one at most per parameter (two would be an intersection of two unknowns, which no instance needs); inference takes the narrower: a type argument decided where a value is passed in takes the bounding argument when that is a subtype of the type given and not the other way round (digit() | success(4)is aRule[Input, long], not an error), and a bounding parameter nothing else decides is taken from the one it bounds. Alternatives weighed: refusingdigit() | success(4)and making the caller write|[Input](correct but unpleasant at the most common call shape); allowing a later parameter with a cycle check, as lower bounds do (more to say for no program that needs it); a type’s own parameters bounded too (sound only for a covariant or invariant bounding parameter, a rule that can come when a program asks). Review with the user: the declared-before rule, which differs from the lower bound’s. -
Settled on the user’s delegation 2026-11-18 (branch
contra-join, for the parsing library’s token streams): branches join at a contravariant argument to the meet of the two arguments, and a fully known expected type wins over a join that misses it (generics).In[A]andIn[B]forIn[-T]agree onIn[B](they fell back to a trait both share,Displaywhere an impl gave one, and then missed an expectedIn[B]); a function type’s parameters join the same way and its result as a covariant argument, so(A) -> intand(B) -> intagree on(B) -> int(they agreed on nothing). Choices this branch made: the meet is one of the two arguments, the one that is a subtype of the other (Nothingincluded); where neither is, no type is named as the meet and the class join does not exist for the pair, so the fallback to a shared trait stands, as for two classes with no common superclass. Where the expected type is fully known (no inference variable left in it), a reference type, and what the branches agree on is not an instance of it while both branches are, the branches agree on the expected type: aDogand aCatthat areAnimals andPets agree onPetwhere aPetis expected (they agreed onAnimaland failed). Where neither the agreement nor a branch is an instance of that expected type, the branch (ormatcharm) is reported, “this branch yields Sink[string], not the Sink[B] expected of theif“, rather than the fallback trait at the result. Why: the expected type is what the program asked for, and a join that misses it while every branch meets it is a wrong answer, not an ambiguity; naming the branch says what to change. Alternatives weighed: the expected type always winning where both branches fit (testing a branch against an expected type still being inferred settles its inference variables, so the rule is held to fully known types and leaves inference as it was); a nominal meet of unrelated arguments, the greatest common subclass (none can be named in general, and an intersection type is not a type Avin writes); keeping the result-level message (it names a trait the program never mentioned).
Open
-
Whether constructor traits may carry parameters that are not holes (an error type fixed per trait,
MonadError[A, E]), and whether composed constructors (Option[List[_]]) are wanted; both are left out of the higher-kinded design and need no change to it to add later. -
Exporting a whole module as a member of another (
export a.b), which needs modules as members. -
Tooling for exports: completion after
m.and in an import group listing a module’s exports beside its declarations, and the IntelliJ plugin’s resolution following an export to the declaration (go-to-definition, find usages, renaming through an export). -
What a comprehension over a
Mapyields when its values are not pairs (it needsIterable‘s own transformations). -
Packages, where Sysl’s choice does not transfer (packages):
- Whether a build should re-hash
vendor/on every run, catching a hand edit to a committed vendored package, or trust the hash recorded beside each package as it trusts the cache’s.
- Whether a build should re-hash
-
Lightweight threads, the open parts of the settled design above (cancellation is under Proposed): none is left open. Stack size and growth are settled above (branch
lwt-stacks), and keeping user-interface work on the main thread is settled above as threads pinned to the main thread (branchmain-lwt). The allocation chunk belongs to the carrier (proposed above), so thousands of parked lightweight threads hold no chunk each. The collector needs nothing new: its roots are what the runtime’s callback marks, so a parked lightweight thread’s context keeps its exact shadow stack and is walked as an attached thread’s is, and switching stacks happens only at the runtime’s own safepoints, so no collection sees one half done. -
Settled on the user’s delegation 2026-11-06 (branch
check-stops-early):avin checkstops after type checking. Checking a program no longer lowers it, builds the shims of its Sysl bindings or builds its C unit: the previouscheckdid all three and threw the result away, 4.9 s against 0.4 s of checking on a terminal-interface example. Two diagnostics came only from those later steps. A C declaration that names no header needs no C compiler to find, socheckreports it. A Sysl binding Sysl rejects, and what clang rejects of the C unit (a constant that does not fit, a prototype the header contradicts) need the real tools, and stay behindavin check --bindings, which runs the whole pipeline up to the emitted code ascheckused to. Why: a type error is the common failure and should cost what checking costs; a binding changes rarely andbuild,runandteststill report it. Alternatives weighed: moving the shim’s type-check into the checker (a second implementation of Sysl’s inference, certain to drift); keepingcheckas it was (the slowness this fixes); dropping binding validation fromcheckwith no flag (leaves no command that reports a bad binding without linking). The language server already stops at checking, so it matches the newcheck. Review with the user: whether--bindingsshould instead be the default for packages that have bindings. (Revised 2026-11-15, branchc-opaque-errno:checkbuilds the C unit too, so what clang rejects of it is reported without--bindings.) -
Settled on the user’s delegation 2026-11-15 (branch
crypto-pbkdf2-uuid):avin.cryptogainspbkdf2HmacSha256andpbkdf2HmacSha512, takingVector[byte]orstringfor password and salt ashmacSha256takes its key and message. Bound tosysl.crypto.pbkdf2_hmac256/512through a runtime shim (avin.rt.digest_pbkdf2_*), since Sysl’s takes an unsigned count and an output slice; no OpenSSL involved, as the other digests. A count below 1 and a length below 1 or over 255 digests (8160, 16320) trap in Avin with the library’s message style, so the shim never sees them. Alternatives weighed: returning aResult(a bad count is the caller’s bug, asbetween‘s bad bounds are); OpenSSL’sPKCS5_PBKDF2_HMAC(adds a dependency for a digest Sysl has). -
Settled on the user’s delegation 2026-11-15 (branch
crypto-pbkdf2-uuid):Uuidlives in its own moduleavin.uuid(library/avin/uuid/uuid.avin), asavin.randomandavin.cryptoeach have a directory; it is adata Uuid(high: long, low: long)so equality, hashing and sending come from the structure, withOrdimplemented as the unsigned order of the sixteen bytes.parseandfromBytesanswerOption(the input comes from outside); only the canonical text is accepted, because braces andurn:uuid:are other formats, not spellings of this one. The constants areUuid.NilandUuid.Max, PascalCase likeDuration.Zero, notnil.variant()answers 2 for RFC 9562’s layout (the value of its bits10), 0, 6 and 7 for the others, as other platforms number them.FromParamis implemented inavin.net.http‘sparams.avin, which importsavin.uuid(which imports nothing fromavin.net, so no cycle). Review with the user: theNil/Maxspelling and the variant numbering. -
Settled on the user’s delegation 2026-11-15 (branch
real-bits-normalize):realreaches its IEEE 754 encodings throughtoBits -> long,real.fromBits(bits: long),toBits32 -> intandreal.fromBits32(bits: int), and there is still no 32-bit float type (types). A binary protocol (PostgreSQL’sfloat4/float8) or file format needs the encodings, and a program that needs binary32 needs it only at that edge, so the 32-bit forms convert at the boundary rather than adding a type every arithmetic rule would have to cover. The members are parameterless accessors and statics, asisNaNandreal.PositiveInfinityare; the encoding is signed (long,int) because there are no unsigned integers, so(-0.0).toBitsislong.MinValue. Narrowing is the hardware’s conversion: round to nearest, ties to even, overflow to an infinity, and a NaN quieted with the top of its payload kept (ARM64 and x86-64 agree), so a signaling binary32 NaN does not survive a round trip; binary64 bits pass unchanged. Bound tosysl‘sFloatBitsthrough four runtime functions (avin.rt.real_to_bitsand its siblings). Alternatives weighed: afloattype (the size of the language change, for an edge need); returningVector[byte](every protocol orders bytes its own way, and the integer is what shifting code wants); namesdoubleToLongBits-style (Avin names members by what they answer). Review with the user: whethertoBits32should trap rather than give an infinity on overflow. -
Settled on the user’s delegation 2026-11-15 (branch
real-bits-normalize): Unicode normalization isstring.normalize(form: NormalizationForm)andisNormalized(form), the formsNfc,Nfd,Nfkc,Nfkd(types).NormalizationFormmirrorssysl.unicode.Form, so the data is utf8proc’s Unicode 17.0.0, the databasechar‘s methods andavin.regexalready answer from, and no table is generated or carried for it; a mirror’s variants must have the Sysl names, andNfcis also how Avin spells an acronym in a name (Utf8Error,TlsStream), so the brief’sNFCbecameNfc. A code point unassigned in 17.0.0 is left alone (utf8proc’sSTABLE). A string of ASCII characters only is answered without crossing into Sysl, since it is in every form;isNormalizednormalizes and compares rather than using the quick-check property, which utf8proc does not expose. Tested against every line ofNormalizationTest.txt17.0.0 (committed astests/fixtures/unicode/NormalizationTest.txt, 1 MB with the character-name comments removed; the original’s SHA-256 is in the test) and every code point its part 1 does not list. Alternatives weighed: variantsNFC… (refused by the mirror, and against the naming rule); four methodstoNfc… (four names for one operation with a parameter); a table of Avin’s own (a second copy of the database to keep in step). Review with the user: the variant spellingNfcoverNFC, which every other platform writes in capitals. -
Settled on the user’s delegation 2026-11-15 (branch
real-bits-normalize):saslPrep(text) -> Option[string]inavin.crypto, RFC 4013 over RFC 3454’s tables B.1, C.1.2–C.9, A.1, D.1 and D.2 (system library). It lives beside PBKDF2 and HMAC because its one use is preparing a SCRAM password. The tables are generated from the RFC’s text byscripts/stringprep_tables.avinintolibrary/avin/crypto/stringprep_tables.avin(8 KB of hexadecimal runs, decoded on first use into a sorted array searched by halves), since stringprep fixes them at Unicode 3.2 and the current database would answer differently. Unassigned code points are prohibited, as for a stored string (RFC 3454 §7), the stricter of the two forms, which PostgreSQL’s own SASLprep also applies; normalization is the current NFKC, which differs from 3.2’s only for the few CJK compatibility ideographs Unicode corrected since. U+200B, in both C.1.2 and B.1, is mapped to a space, the C.1.2 mapping being applied first; the two orders differ only for it. Prohibition and the bidirectional rule are checked on the normalized string, as RFC 3454 §3 orders the steps, so U+0340 (prohibited) normalizes to U+0300 and is accepted.Nonecarries no reason, since a client’s only response is to fall back to the password as written. Alternatives weighed:Result[string, SaslPrepError]naming the step that refused (no caller acts on the reason); anallowUnassignedflag for the query form (no SCRAM use needs it); a genericstringprep(profile)(no second profile is wanted). Review with the user: whether a reason should be returned after all. -
Settled on the user’s delegation 2026-11-16 (branch
gc-pacing):AVIN_GC_PERCENTpaces the collector (runtime). After a collection the heap may allocate that percentage of what survived before it collects again, and never less than the 8 MiB floor; the default stays 100, so the heap keeps within about twice what is live, as before. The value is decimal digits; one that is not, or is longer than 15 digits, is ignored; 0 paces by the floor alone, and anything above 100000 is taken as 100000. Measured on a program keeping 200k small objects (37 MB live) while discarding ~800 bytes per element: collection time falls from 3.79 s to 2.06 s at 200 and 1.12 s at 400, for a heap 1.2× and 1.5× as large. The pacing itself was already proportional to what is live, so the cost per element allocated levels off once the live heap passes the floor; what remains is that every collection traces the whole live heap (about 30 ns an object) and walks every block the sweep can reach. Alternatives weighed: a larger default (faster, but a program’s memory would grow with no setting of its own; left for the user); a library call to set it at run time (no program needs to change it mid-run yet); a floor that scales (it only matters below 8 MiB live). Review with the user: whether the default should be above 100, since the collector stops every thread and marks on one, so the trade favours memory less than it would for a concurrent collector. -
Settled on the user’s delegation 2026-11-16 (branch
read-alloc): a stream’sread(max)allocates what it answers, notmax. A TCP, Unix or split socket read receives into a buffer the runtime keeps per operating system thread (on its carrier), grown to the largest read asked for up to 256 KiB, and copies out exactly the bytes that arrived; a read asking for more than 256 KiB answers at most that much, which the contract (“up tomax“) already allows. A TLS read decrypts into a plaintext array the connection keeps, ofmaxbytes up to one record’s 16 KiB, reused while reads ask for the same size and replaced when they do not. The contract and API are unchanged. Alternatives weighed: asking the kernel how many bytes are readable (FIONREAD; one more system call per read, and no binding for it); a buffer kept per stream on the Avin side (the binding still copies the whole buffer in and out at every call, and an idle server would hold one per connection); reading ahead into the stream’s buffered bytes (changes what a select’s descriptor says). Review with the user: the 256 KiB ceiling on one socket read. Each try at a receive ends its view of the carrier’s buffer before the thread can wait (branchpool-trap, 2026-11-17): a view held across a park was let go on whichever carrier the thread resumed on, changing the buffer’s count there while the buffer’s own carrier used it, which freed it under other threads (a crash inmalloc, or corrupted bytes, with thousands of threads reading at once). -
Settled on the user’s delegation 2026-11-23 (branch
http-date): HTTP-dates live inavin.timeasInstant.toHttpDate()andparseHttpDate(text[, now]). They sit beside the ISO 8601 text and parse, shareTimeParseError, andavin.net.httpimports them. Writing is IMF-fixdate only, drops the fraction toward the earlier second, and traps outside years 0000 to 9999 (the form has four digits; it matchesdate(...)trapping out of range, and no real header value is outside it). Parsing is exact: a day name that is not the date’s is refused (OutOfRange(text, "weekday")), names andGMTare case-sensitive as RFC 9110’s ABNF is, widths are fixed, extra whitespace anywhere is refused,asctime‘s day under ten must be space-padded, a second of60is refused as in every other parse. A two-digit RFC 850 year follows RFC 9110’s fifty-year rule againstnow, which is an argument of the two-argument form so the rule is testable and the one-argument form reads the clock. Alternatives weighed: a lenient parser ignoring the day name or case (what some servers do; it accepts corrupt dates and hides client bugs, and a caller can always trim or fold case first);Optioninstead ofResult(every other parse here says why); the format as a method onZoned(an HTTP-date is always UTC, so anInstantmethod has no zone to get wrong). Review with the user: strict weekday and case checking onIf-Modified-Since, where a lenient server would answer 200 instead of ignoring a malformed date, which RFC 9110 also allows. -
Settled on the user’s delegation 2026-11-23 (branch
http-date-header):http.servesends aDateheader on every response, switched off bydate: bool = true. RFC 9110 section 6.6.1 requires it of an origin server with a clock in 2xx, 3xx and 4xx and allows it in 1xx and 5xx; it is sent on every status the server writes (5xx and its own400/503included, since a client or cache gains from the clock there too) and not on the101of an upgrade, which the protocol switched to has its own say on. ADatethe handler set, in any case of the name, is kept, asLast-Modifiedand the like are the handler’s. The text comes fromDateHeader(clock = now), a public class so its rollover is testable with a clock of the test’s own: oneAtomicholds the latest second and its text, a read compares the clock’s second with it, and a thread that finds the second over formats and stores the next (two threads doing so store equal texts, and a store racing a later one is corrected by the next read, each answer being right for its own clock read). Alternatives weighed: a mutex around the text (a lock on every request’s path); a timer actor refreshing the text (a thread idling in every server, and a stale text if it is starved); formatting on every response (about a microsecond of calendar arithmetic per request); aDuration-valued setting naming a refresh period (the second is what the header can show). The switch is a bool nameddate, as the header is. Tests that read raw heads passdate = false. -
Settled on the user’s delegation 2026-11-23 (branch
http-cookies): cookies inavin.net.http(Cookie,SetCookie,SameSite,CookieError;ServerRequest.cookies()/cookie(name),Response.setCookie/cookies()). Choices: (1) reading aCookieheader is lenient and per pair: a malformed pair is skipped and the others kept (one bad cookie must not hide the session cookie), with a value read only if every octet is a RFC 6265 cookie octet (commas and spaces in values are skipped, not accepted as some servers do); duplicates are all kept in order. (2) Making aSetCookietraps on a bad name/value/domain/path, on a broken__Host-/__Secure-rule (prefixes compared without regard to case, as browsers do) and onSameSite=NoneorPartitionedwithoutSecure— the library’s convention for a programmer-supplied header value (aswithHeader), nothing escaped or cut; the secure default is thatSecureis never implied, only demanded. (3) TheSameSitevariant forNoneisUnrestricted, sinceNoneisOption‘s and would makeSome(None)ambiguous; it is writtenSameSite=None. (4)Max-Ageof zero or less is accepted and written0(the grammar has no negative and the meaning is the same). (5)SetCookie.parse(client) is anErrfor what a browser would reject (bad name/value, prefix rules,SameSite=None/PartitionedwithoutSecure) and ignores attributes it cannot read;Expiresis read only as an HTTP-date (viaparseHttpDate), not by RFC 6265’s lenient date algorithm. Alternatives weighed:Resultconstructors (a second constructor path for every cookie a handler writes); quoting values that need it (mangling); treating a pair without=as an empty-named cookie (6265bis; no server needs it). A cookie jar (domain/path matching, expiry, public suffixes) is a later item. Review with the user: strict value octets onCookie(a client sendinga=b,closes that cookie).