Skip to content

v0.2.4

Choose a tag to compare

@github-actions github-actions released this 07 Nov 18:22
· 66 commits to main since this release
1725bad

v0.2.4 — sixteen defects, every one reported by a program that uses the language

The first release driven entirely from outside. Nothing here was found by
reading the compiler; every item came from shroom-slots, a game of about
twenty units, or from algol24.com, this language's own website — both written
in Algol-24 by people meeting the language as users of it. All sixteen reports
are closed, and ./defects.sh is a new harness that holds them closed.

Five reports were one bug

A bare name was resolved against every declaration in the program rather
than against the file it was written in. So a name declared in any unit could
quietly take over a name in another, and the C back end was the only processor
that got it wrong — which meant a program ran correctly interpreted and
misbehaved when built for release.

Its worst shape: a program-level variable named after an imported enumeration's
member read as the member, so every assignment to it was discarded in
silence and the name was permanently truthy. In the game that meant paying out
every win and charging for no spin, with the balance climbing and nothing
warning. Its most confusing shape put an error inside a unit the program never
edited
, naming the wrong file as the one needing an import.

Two new rules say what the answer is. [MOD-016]: a file's own top-level
declaration is resolved before its imports. [MOD-017]: a top-level
subprogram visible in a file is resolved before a member of a class declared
there — and one that is not visible does not enter the question at all. The
second was measured in both directions before it was written, because the
behaviour is sharp: the same class body means different things depending on what
its own unit imports.

A runtime error now says where it happened

In the interpreter and the bytecode machine: file and line, on a second
line below the message.

⚠️ Compiled Algol-24 deliberately does not carry source information at run
time
, and will not. Carrying it means the emitted C storing a position before
every statement — a cost every program pays forever so that a failing one can be
read. A program that wants that runs under the machine, which can disassemble
itself
: --list walks every chunk, --trace N keeps a ring of the last N
instructions with the stack pointer, frame base and call depth, and
--watch TEXT dumps the instant a message is raised, caught or not. That is the
division of labour the machine exists for, and [ERR-003] now states it.

Each processor finds the location its own way, which is the point: the walker
publishes it as it runs, and the machine recovers it from its own instruction
pointer
where a fault is caught — so the machine pays nothing at all until
something fails.

ErrorLn, and why the language needed it

[RT-030] adds one built-in: ErrorLn writes a line to the error stream,
taking any number of values and joining them exactly as WriteLn does.

The language previously had no way to reach that stream. A program that
detected something wrong had to write to its own output, so a diagnostic could
not survive prog > results.txt without corrupting what the program produced —
it had to choose between being seen and being separable. Fixing the runtime
error above was impossible without it.

It flushes standard output first, which fixes a second thing: a program's own
output now comes before the error that stopped it.
It always had,
chronologically; standard output is buffered the moment it is redirected, so in
every pipe and every log a program appeared to fail before it had printed
anything. A program's last output before dying is the most useful thing it has.

⚠️ That reordered every located diagnostic too, and the old order was the
artefact.
A parse error's excerpt was always written before its message and
only appeared second because it sat in a buffer. [ERR-005] now shows
excerpt-then-message, which is what every other compiler prints.

A diagnostic names the file its token came from

It used to name the root file over whichever file had last written that line
number — so a fault inside an imported unit was reported against the program,
over a line the program need not even have. One case pinned a three-line
program being blamed for line 12.

The tree-walking interpreter collects garbage

It had declined to, for a reason that had stopped being true: its live values
were said to sit in C locals where no collector could see them, which the
precise shadow stack overtook. 2.8× less memory for about 9% more time on
the heaviest interpreted run available.

⚠️ The compiled back end has had a precise collector since v0.2.0 and never
leaked. That is easy to misremember as a machine feature and is not.

Two warnings where the compiler knew and waited

A call whose argument count matches no declaration of the name, and a name
that cannot be reached from where it is written. Both used to be discovered
when the line ran — which in one case meant a shipped program that could not
start at all, and in another an abort on a device with no console, where the
language's good message went to a stream nobody was reading.

Both are warnings and not refusals, because both programs are legal: a free
name on a path that never runs is never resolved. The cost is made visible
rather than forbidden.

Smaller fixes, each with a sharp edge

  • A built-in's name folds like any other identifier, so Clock is clock.
    It did not in the C back end, where eleven of eleven non-canonical spellings
    became latent aborts. It bit unevenly, which is why it lasted: clock is the
    only built-in spelt lower-case, so writing the natural Clock was enough —
    and the library had exactly that, waiting for a caller.
  • A built-in can be held as a value in compiled code, which it could not at
    all. var F := Length is interned, so Length = Length is true across units.
  • Two units whose names differ only in case are refused on every platform
    alike. Unrefused the program meant three different things at once.
    ⚠️ macOS and Windows fold filenames and Linux does not, which is the
    opposite of the natural guess.
  • A field of this beats a built-in of the same name, read bare inside a
    method; a visible global beats the field. Two processors disagreed in
    opposite directions.
  • algol.c and algol.h refuse to build as a mismatched pair. Assembling
    one of each used to give twenty errors reading as a corrupt runtime; it now
    gives one naming the real fault.
  • A missing --out directory says so, rather than naming a file nobody
    asked about.
  • Expect expression! carries its file, line and caret, which it alone did
    not — and it is the error a semicolon after end produces.


Installing

Windows

algol24-vm-0.2.4-windows-x86_64.zip is the
bytecode machine with the Algol-24 runtime library beside it.
Unzip it anywhere and run algvm.bat, which sets the two things
the library needs: where its units and glyph files live, and where
its C shims are.

Built with mingw-w64, and foreign calls work -- external reaches
a DLL through the same declaration a Unix uses, because the shims
are named .so on every platform on purpose.

macOS and Linux

brew tap schildawg/algol24
brew trust schildawg/algol24
brew install algol24-vm   # the machine and its library
brew install algol24      # the compiler

The two coexist: one installs algvm, the other algc.


RELEASES.md in the source tree is the cumulative account, newest first.
spec/ALGOL-24.md is the specification and the authority.