306 Commits

Author SHA1 Message Date
cb83014715 (clone xs) copies any slice's elements into a block from the context allocator or a named one, through the lowering (bytes s) uses 2026-09-25 11:40:42 +07:00
2682214499 A defclass slot may declare a type that every store into it checks, and set writes a declared slot 2026-09-25 11:40:08 +07:00
3cb6cebdbe (- x) negates a typed number, a type variable and a dyn, and a float's negation of zero is -0.0 2026-09-25 11:37:56 +07:00
680c12e686 A restart frame carries where its clause is written, its :report sentence and whether a handler-case made it up, and the break loop shows the first two and hides the third 2026-09-25 11:35:12 +07:00
de8e00314b A string literal handed to a declare-c reaches C uncopied, and both backends write a NUL after every literal 2026-09-25 11:33:03 +07:00
315125c677 A literal arm of an if, a cond or a match takes its type from the arms that are not literals 2026-09-25 11:32:54 +07:00
5062052425 Raylib's strings, models, file lists and matrix stack are bound, and a dev build can name what is still loaded at exit 2026-09-25 11:28:02 +07:00
14bac84f53 != over floats is unordered, so a NaN is unequal to itself on both backends as it already was on the dyn side 2026-09-25 11:27:49 +07:00
05d86b243f A library resource is known by its identifying field, a Get or a consuming Load is counted as raylib means it, bare pointers are not resources, the report waits for FLAN_DEV_LEAKS, and a release build emits the code it did before the tracker 2026-09-25 11:27:41 +07:00
9e26275f9b A quasiquote nests as SBCL's does, a match takes an enum, and until is a prelude macro 2026-09-25 11:27:14 +07:00
494c57d764 Merge branch 'master' into worktree-agent-ae2997a1e90aa9e02 2026-09-25 11:18:12 +07:00
840b3b215e A Map's churn test fails a table that doubles instead of sweeping, and nothing recalled is cited as read 2026-09-25 11:18:12 +07:00
389e93ff09 A capturing fn's environment belongs to the collector, so a closure may outlive the frame that made it 2026-09-25 11:13:57 +07:00
d03b02b347 Merge master 2026-09-25 11:12:30 +07:00
0d771494a6 Merge branch 'master' into worktree-agent-a8f5ad274482eeb9c 2026-09-25 11:07:02 +07:00
8bebff61eb Merge branch 'master' into worktree-agent-a8f88805fa4af49cf 2026-09-25 11:01:36 +07:00
3f30b82bcb A return computes its value before its defers, and a dozen small refusals and constants say what the program meant 2026-09-25 10:54:09 +07:00
2f3544e7f5 Code after a return emits nothing, a wide element names the u64 array, and $ is refused in fn, handler, :keys and & binders 2026-09-25 10:53:52 +07:00
0a6ea7c32b A caller excused for going stale takes back the generic copies its failed check cached, and a package's stale callers are named at their own file and line 2026-09-25 10:51:44 +07:00
fe20f68ada The runtime's races are driven by tests, a destroyed arena's record is reused, and a dyn index names its site 2026-09-25 10:51:08 +07:00
a49ed2243a Merge branch 'master' into worktree-agent-a4be641f87966b149 2026-09-25 10:48:05 +07:00
0863b62711 A string returned from C is copied into the context allocator, Model, Mesh and FilePathList cross the raylib boundary, rlgl's matrix stack is a package, and a dev build reports the library resources a program never released 2026-09-25 10:44:49 +07:00
39d35f51db A function whose signature changed installs, and a caller compiled against the old one stops on StaleCall at the call
A dev cell carries its body's signature word beside the body, every call through a cell (and every function value taken from one) compares it with the word the site was compiled for, and the session lists the stale callers by file and line on the reply. Both backends, both installers; release builds have neither the word nor the compare.
2026-09-25 10:40:18 +07:00
e9e151e1a4 A match over an enum names its members as keywords and is refused when it misses one 2026-09-25 10:33:22 +07:00
83b244475a A refusal that suggests a fix suggests one that compiles, for vec-new, map-new and a near miss that is a value 2026-09-25 10:30:52 +07:00
6c9635cd53 A wide literal is refused for its range as an enum member, names the u64 cast where a dyn is wanted, and comes back wide from a macro 2026-09-25 10:26:03 +07:00
5581bafacb A dyn at, set-at or push that traps names the file, line and column it was written at 2026-09-25 10:25:28 +07:00
dd160aa31b A return computes its value before it runs its defers 2026-09-25 10:19:09 +07:00
e511174d3c No top-level value in the compiler goes unreferenced 2026-09-25 10:16:25 +07:00
d006a8b480 An array literal's first element types the rest, constant arithmetic folds at a bounded type variable, and a pointer or a plain union takes a byte fill 2026-09-25 10:14:24 +07:00
4a292b5a73 f64-inf, f64-nan, f32-inf and f32-nan are constants the compiler supplies 2026-09-25 10:07:22 +07:00
11dc230974 A defn- is private to its module, and the module's own macros may call it 2026-09-25 08:57:20 +07:00
793b0eea9e A defn- is private to its module, the package's own macros may write calls to it, and the refusal names the fix 2026-09-25 08:55:37 +07:00
00f116ea29 Six small refusals and conversions say what the program wrote 2026-09-25 08:41:31 +07:00
ff744120fc A release build's watch is only its value, next-error lets go of a stack that has resumed, and the frame a stop is in is always shown 2026-09-25 08:36:53 +07:00
cb0be62087 An integer written at or above 2^63 is a u64 and nothing else, and vec-new reads a type from its argument only when the builtin is what was called 2026-09-25 07:43:24 +07:00
6fd456c0a2 A function declared with defn- is callable only from the files of its own package 2026-09-25 07:42:40 +07:00
85b9f35a66 (watch "name" v) renders any value into the watch table the way print renders it 2026-09-25 07:22:59 +07:00
f142cfaadf A u64 constant above 2^63 can be written in decimal, and a cast's integer literal too wide for i32 is read at the cast's type 2026-09-25 07:16:42 +07:00
aa5052e401 A dyn value an expression answers is the reply's value, not the program's output 2026-09-25 07:14:13 +07:00
aa629da2e5 vec-new and map-new take a type expression where they take a type, so (vec-new [u8]) makes a Vec of byte slices 2026-09-25 07:10:48 +07:00
b4e19bebf8 A loop's initialisers are checked in order and each sees the names bound before it, as a let's do 2026-09-25 07:06:17 +07:00
45cc4d20e8 One file holds what five did
# Conflicts:
#	FIX.org
2026-09-21 21:07:40 +07:00
57fe91f303 Five records become one, and every citation lands somewhere
FIX.org, NEXT.md, DISCUSS.org, docs/DISCUSS.md and the session handoff at the
root are one TODO.org now: 293 entries under seven subsystem headings, each
carrying an org keyword that says where it stands. A DONE entry is a few lines
saying what was decided and what that rules out; the reasoning that would not
compress — the embedding spike and the four reports the hand-written x86
backend was built from — moved into docs/BUILT.md instead, and its entries
point there in one line.

Every entry was checked against the tree before it got a keyword, and the
prose was wrong in both directions. Things the deleted files called open were
built: the first-evaluation stall, main being redefinable, macro parameter
lists, the type-limit constants, the array constructors, the byte fills,
inc/dec, the discard's fontification, the Emacs buffers, rt_die's _exit, the
backtrace surface, and the acceptance failure that could print and still exit
zero. Things they called done were not: the backend reports' no-plan buckets
had gone stale in the other direction, the value-dependent defvar was
superseded rather than built, and macro-expansion source locations are on an
unmerged lane, so that entry is NEXT and names the branch.

Every comment that cited one of the five by name now cites a heading that
exists, in TODO.org or in docs/BUILT.md. The session reports under
docs/handoffs/ keep naming the files they worked on, because rewriting them
would falsify what those sessions did; each carries a note saying where the
content went.
2026-09-21 21:05:48 +07:00
Joseph Ferano
a14a872a44 A form a macro splices through is reported on the line it was written on 2026-09-21 19:16:45 +07:00
0c711942f7 A thunk named for the order it was minted in is a different signature after a reorder
Three from a review of the commit before this one, and the first is a dev
loop defect.  Naming the widening thunk thick/<count so far> put traversal
order into a symbol, and Session.compatible compares a reload's functions
against the running program's by name -- so swapping two calls in a body
renamed nothing the programmer can see and reported "thick/0 changes
signature, from [i32] i32 to [i64] i64.  Restart to change it."  The name is
the signature again, written by thick_enc: every type self-delimiting, an
atom as its length and then its spelling, so the boundaries mangle_ty loses
are in the string rather than inferred from the separators.  mangle_ty is
untouched -- it is load-bearing for the instantiation names a backtrace, a
Reach edge and a dev cell show -- and the memo stays keyed on the types.
fn-thunk-reload.flan is the pair of widenings and test_session reorders them.

The second was a silent miscompile.  bind_ty's Fn-pattern-against-CFn-argument
arm was structural, so it matched nested function positions too, and the
catch-up pass that builds the thunk compares the whole substituted parameter
list -- false when the mismatch is inside one, and the fallthrough handed the
argument over unchanged: one word where the instance declares two, 255 on
both backends with nothing said anywhere.  The widening is a value the caller
builds around the whole argument and there is nowhere inside one to build it,
so the arm is admitted at the top of an argument's type and nowhere else, and
the catch-up arm is total over the pair rather than guarded -- bind_ty's
fallthrough is Types.fits, which admits Never, so a binding can still succeed
over a pair the two words cannot bridge.  fn-generic-nested.flan is the
parameter position and fn-generic-nested-return.flan the return one.

And the third closes the hole the escaping inversion was for.  A match arm
binds the case's fields to slots and the store that fills them is inside the
branch, not in any form escape_check reads as a binding, so (match o (Some f)
f ...) handed back through a name what a case-field read cannot hand back at
all -- sound only because Some_ denies suspects.  An arm's slots of function
type are suspect now, for the same reason the read itself is.
2026-09-21 15:44:28 +07:00
a28aeda633 The thunk memo was keyed on a name that two signatures can share
Review found it, and it is a silent miscompile on both backends rather
than a refusal anywhere.  mangle_ty flattens a whole signature into one
hyphen-joined string, so (CFn [(Ptr i32)] i32) and (CFn [ptr i32] i32) --
the second over a struct someone called ptr -- flatten alike; keyed on
that, the second widening reused the first's thunk at the wrong arity.
The key is the types now, compared with Types.equal, and the symbol is a
counter over the thunks already minted, so nothing is derived from a
spelling.  fn-thunk-share.flan is the pair, and it prints 5 and 17.

And a regression beside it: a generic whose function parameter binds the
type variable.  (defn apply2 [f (Fn [$t] $t) x $t] ...) called as
(apply2 bump 1) compiled before this lane and stopped, because bind_ty
had no arm admitting a CFn argument at an Fn pattern -- and once it had
one, the call still handed one word to an instance declaring two, because
a parameter that still mentions a variable is checked with no expectation
and expect never sees the pair.  Both halves: the arm, and the widening
in generic_call's catch-up pass beside the numeric one.  The same gap hid
new functionality -- a CFn argument at a (CFn [$t] $t) parameter had no
arm either -- and mentions had no CFn case, so bound_exactly answered
wrong for a variable living only inside one.

The corpus missed all of it because the prelude binds $t from an earlier
argument, so the parameter is concrete before bind_ty sees it.

While here: escaping's enumeration is the *clean* set now rather than the
suspect set.  It had a hole where a list like that cannot -- an (at s 0)
over a slice of Fn read as clean while the Vec, struct and pointer
spellings were refused.  Unreachable today, and the header claims the
list is closed.  The same inversion fixes which refusal message an index
read gets.

Three minors: Anull was defined and never constructed; the capture-dyn
message substituted a descriptor into a noun slot; and session.ml
rendered a defn's changed signature as (Fn [...] ...), which is now a
real type and not the same as (CFn [...] ...) -- it writes the parameters
and the return the way a defn writes them.

And one rounding corrected in the docs: handler-bind is not free for a
program that captures nothing.  %handler grew from 24 bytes to 32, every
push writes a null into the new field, every clause gains ptr %env with
an alloca and a store, and flan_signal passes one more argument per
dispatch -- twenty changed x86 lines on loops.flan.  Small, real, and
paid by every conditions program.
2026-09-21 13:41:44 +07:00
2572f0a537 An fn sees the locals it was written among, and Fn says so in its type
spec-memory.md's case 2, capture by value into a stack environment, and
the calling convention the author's rulings asked for.

    (Fn  [i32] i32)   captures; {code, env}; the common case
    (CFn [i32] i32)   the bare address; one word; cannot capture

A local of the enclosing function that an fn names is copied into a
struct the checker synthesises, held in a slot of that function's frame,
and the value carries its address; the lifted body reads the copies back
into named slots of its own, once, at entry.  So the name in the body
means what the local held at the instant the value was made --
fn-capture.flan changes the local through a pointer after the value
exists and the fn still answers with the old one.

Two types rather than a uniform environment parameter: "while it's dyn
first, static side should never have to pay the price for the existence
of the dyn side... if you fully opt out, for instance, using --no-gc
flag, then we should be operating under Odin/C semantics and never paying
any runtime costs."  The environment is declared by exactly the bodies an
(Fn ...) value can reach -- a lifted literal in an Fn position, every
handler clause, and the widening thunks -- and by nothing else.  An
ordinary defn emits the signature it always did; calc-me and fourteen
corpus programs were diffed to say so.

CFn, because the C carries information: a value with no environment is
the only kind that could ever cross to C, and under the --no-conditions
direction FIX.org records it becomes literally a C function pointer.  It
is not that today -- a declare cannot take a function type at all -- and
crossable's refusal says so where a reader would otherwise be misled.
Nobody needs CFn: Fn accepts everything, and the commonest reason to
reach for the narrow one is that a *named* function handed to an Fn pays
a hop through the widening thunk where a CFn is a direct call.

That thunk is one small function per distinct signature widened, which
reads the bare address back out of the environment and calls it.  The
cheaper trick -- the environment last, ignored by a body that never
declared it -- is legal under SysV and is a trap under wasm32's
call_indirect, which compares the signature at the call.  Every indirect
call is exactly typed now.

A handler clause captures the same way and is sound with nothing left
over: its frame is popped by the body that pushed it.  What is refused
there is a *store* into a captured name -- it is a copy, and writing to
it would leave the local as it was.

And the other half, which is what "non-escaping" means: a value carrying
an environment may be called, passed down and let-bound, and may not be
returned, stored, pointed at or pushed into a container.  A parameter of
type Fn is treated as one, which answers "passed to something that stores
it" with no interprocedural analysis -- the store is refused inside the
callee.  Everything of type CFn is clean for free, which is the second
thing having two types buys.  Every refusal names case 3, the environment
the collector owns.

Two pre-existing bugs fell out on the way.  A lifted fn asked for Fnval,
so `flan reload' on any function containing an fn literal died at llc
with an undefined cell; it takes Flanfn now, which is the choice a
handler clause always made.  And a redefinition module now carries its
own hidden copy of every thunk it names, which is the same bug shape
caught before it shipped.
2026-09-21 13:41:44 +07:00
d6fc15474b The count is length, so len is a name a program can have
The author: "I think I prefer length over len, because then I'll use len as
the variable name". One arm in check.ml, one row in the table beside it, and
every (len x) in lib, test, examples, vendor, spike, docs, web, emacs,
plan.org and NEXT.md rewritten.

Shadowing and builtin/ had already taken most of the sting out: a (defn len
...) was legal and won in its own file, and builtin/len reached past it. What
was left is that len was still a builtin — the defn earned a warning, and a
wrapper had to say builtin/ at every inner call. Now there is nothing under
the short name: len is an ordinary identifier in every position, which is
what (let [len (length xs)] ...) wants.

length takes over as shadowing's worked example rather than the feature
losing one. shadow-builtin.flan, builtin-qualified.flan, pkgs/shadowed and the
builtin/ rows in test_flan move to it and go on testing shadowing.

A call to a len nothing defines is answered where an unknown function is,
after every table and after the shadowing guard, so a program with its own len
never reaches it. The sentence is said rather than guessed at — len and length
are three edits apart and the did-you-mean's net is one — and the call is
written back out through spell_arg, as-slice's spelling lifted out of it and
now shared, so what is printed compiles.

sand.flan:33 still calls the old name and is the author's to change; until it
does, test_acceptance and test_session abort there. Both were run green
against a copy with that one line changed. FIX.org says so.
2026-09-21 11:58:56 +07:00
3672da28be A diagnostic is for someone who has only this compiler, and says what to write 2026-09-21 11:44:59 +07:00