From f8e1140ad8ac0dd12ced811eba5c6ac9a14484d3 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Fri, 16 Oct 2026 11:29:51 +0100 Subject: [PATCH] raz(7), the tutorial and CLAUDE.md for report 2026-10.31 The small types widening to INT and what an operator made not, an enumeration's name with its type, continue and the step before it; the readings the milestone took. --- diff --git a/CLAUDE.md b/CLAUDE.md index f3de1a4..2315a0d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -230,6 +230,20 @@ installed without `SA_RESTART`, so a call it breaks into is -4, which `Out` and `Files` try again. Over C, `ready` and `readyFor` try `poll` again after EINTR only when no signal `handle` took broke in. +- `U8`, `I8` and `I16` widen to `INT`, `U8` and `U16` to `UINT`, one + step only (a `U8` into an `I64` is written), and not in `return f(x)` + (report 2026-10.31). An operator's result on them (`made`) doesn't + widen; a conversion's does, `U8(a + b)` too. +- An enumeration's name shared in its scope with another enumeration's + is written with its type; shared with anything else, the name alone is + that other declaration. A `match` arm on an enumeration takes the + type's names alone or with the type, which must be the matched one. +- `continue` is the last reserved word, so that the others keep the + seed's numbers; the seed's dumpers intern it first + (`src/test/seedcontinue.pas`). +- `Width` follows glibc's `wcwidth` but gives a control 0, and 0 to the + format characters glibc counts as 1 (Egyptian hieroglyph controls, + interlinear annotation), but for the prepended concatenation marks. - An `extern` module variable is read-only for an importer, as the report says of every exported variable (3). - Warnings come only for a module with no errors. A procedure naming diff --git a/doc/raz-tutorial.7 b/doc/raz-tutorial.7 index b7ae4ba..24325f3 100644 --- a/doc/raz-tutorial.7 +++ b/doc/raz-tutorial.7 @@ -184,15 +184,32 @@ Arithmetic wraps at the type's width, and never stops the program, except dividing by zero. .Pp -Two types never mix but for one: +Two types never mix but where nothing can be lost: .Cm INT -into +goes into .Cm I64 , -which loses nothing, wherever the one meets the other, so with +wherever the one meets the other, so with .Cm "big: I64" , .Cm "big + n" is an -.Cm I64 . +.Cm I64 ; +and +.Cm U8 , I8 +and +.Cm I16 , +which an +.Cm INT +holds on any machine, go into +.Cm INT , +so a digit's value is +.Cm "n := n * 10 + s[i] - '0'" . +What an operator made in a small type doesn't, since it may have +wrapped there: with +.Cm "a, b: U8" , +.Cm "n := a + b" +is an error, and +.Cm "INT(a) + b" +the sum. With .Cm "c: I32" , .Cm "c < n" @@ -398,6 +415,19 @@ empty slice, .Cm "0 to LEN(s) - 1" doesn't run at all. +.Cm break +leaves a loop, and +.Cm continue +ends its round: a +.Cm for +steps, and a +.Cm while +tests again; so a +.Cm while +moves on, as +.Cm "i := i + n" , +before it can +.Cm continue . .Sh 6. RECORDS AND POINTERS .Bd -literal -offset indent module Boxes; @@ -853,9 +883,11 @@ when the program leaves the statements the .Cm defer stands in: at their end, or by a -.Cm return +.Cm return , +a +.Cm break or a -.Cm break . +.Cm continue . Deferred statements run the last first, and only those whose .Cm defer was reached. @@ -980,7 +1012,11 @@ 01 .Ed .Pp -An enumeration is a list of names, in order; a +An enumeration is a list of names, in order, each of which may be +written with its type, +.Cm Color.red ; +two enumerations may share a name, which is then always written so. +A .Cm "set of" it holds any choice of them, in the bits of a word, with .Cm in , @@ -1219,7 +1255,8 @@ .It "if (c) {...}" Ta "if c then begin" Ta "if c then ... end;" .It "for (i=0; i