From 4fb20c279b82cb553cac8024f6594427aebd1903 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Fri, 16 Oct 2026 11:53:04 +0100 Subject: [PATCH] PROPOSALS: drop the four v0.17.0 built Enumerations' names, continue, a byte into an INT, Width: all in report 2026-10.31. --- diff --git a/PROPOSALS.md b/PROPOSALS.md index 0259c6b..7fb2207 100644 --- a/PROPOSALS.md +++ b/PROPOSALS.md @@ -369,145 +369,6 @@ procedure values) take years; the narrow form here leaves record lifetimes out, and so the first false alarm above, on purpose. -## Enumerations' names, each its own - -An enumeration's names are declared in the scope around its type -(5.7), so two enumerations of a module can't share a name, nor a -procedure have one: with `Style = (bold, italic, ...)`, a second -`Elem = (..., bold, ...)` is "bold is declared twice", and so is -`proc rule` beside `Kind = (para, rule)`. A module with two lists of -kinds, a style and the HTML element that makes it, names one of them -again: libro's `Flow` has `bEl`, `iEl`, `pEl`, ... for it. - -The proposal: a name of an enumeration may always be written with its -type, `Elem.bold`; and a name that two enumerations of a scope share, -or an enumeration and something else, must be, everywhere. A name only -one enumeration has stays as it is. The type is never guessed from -where the name stands, so the compiler's lookup stays a lookup: a name -it finds twice is an error that says to write the type. Taking the -type from the place (`match` on a `Style`, a `Style` assigned) could -come later, and would break nothing. No program changes, since every -program today has each name once. - -Accepted by the owner, for a thaw. - -Met in libro's `Flow`. - -## `continue` - -`break` leaves a loop; nothing goes on to its next round. A loop that -passes over some of what it reads (a byte to skip, an entry that -doesn't match) puts the rest of its body in an `if`, or a flag, and a -loop with several such tests grows a level of `if` for each: - -``` -while i < LEN(t) do - ch, n := Str.decode(t[i..LEN(t)]); - if ch = 0ADH then - (* passed over *) - elsif ... then - end; - i := i + n; -end; -``` - -The proposal: `continue`, in a `while`, `repeat` or `for`, ends the -round, as reaching the end of the body would: a `while` tests its -condition again, a `repeat` tests its `until`, a `for` steps its -variable. A deferred statement can't hold it, as it can't hold -`break`. With it, the loop above reads: - -``` -while i < LEN(t) do - ch, n := Str.decode(t[i..LEN(t)]); - i := i + n; (* the step first *) - if ch = 0ADH then continue; end; (* passed over *) - ... -end; -``` - -The step comes before any `continue`. Put after it, as `i := i + n` -stood in the first loop, it is skipped, `i` never moves, and the loop -never ends; a `repeat`'s `until` may likewise read what the skipped -rest of the body was to set. A `for` steps itself and has neither -trap. The report's example shows the step first, and the compiler -can't catch it. - -It costs about 15 lines of the compiler (a second chain of jumps -beside `break`'s, fixed at each loop's test or step), a few lines of -the report (7.2, the reserved words, the grammar, 7.7), and a word in -`tools/Scan.raz` and the editors' modes. It breaks a program that has -a name `continue`; none of the raz programs written so far has one. - -Accepted by the owner, for a thaw. - -Met in libro and rml, more than once each, and in concha's -`Csyntax`, whose `interpolate` reads `elsif (c # '$') or not try -dollar(...)` for want of it. - -## A byte into an `INT` - -A `U8` doesn't go into an `INT` without a conversion, though no value -of one is lost there: `c := keys[at]` is "can't use U8 as INT", and a -parser of digits writes `INT(s[i]) - '0'` at every digit. 2026-10.26 -made `INT` widen to `I64` wherever it meets one, for the same reason; -the small types into `INT` are the same, and more common. - -The proposal, in three parts: - -- `INT` and `UINT` are at least 16 bits, on every target (5.1). -- `U8`, `I8` and `I16` widen to `INT`, and `U8` and `U16` to `UINT`, - where their value goes to one: assigned, passed, returned, in - `a, b := f(x)`, a `for`'s bounds, `INC` and `DEC`'s step, and in an - operator that meets an `INT`, as `INT` to `I64` does (5.10). These - are the types an `INT` holds whole on every target, so a program - that compiles on one compiles on all. `U16`, `I32` and `U32` still - need `INT(x)`; were `INT` at least 32 bits, `U16` and `I32` would - join, and the minimum can be raised later, never lowered. -- What an operator gives on two narrow operands doesn't widen. raz - works in the operands' type, so with `a, b: U8`, `a + b` is a `U8` - that wraps: 200 + 100 is 44. Widened silently, `n := a + b` would - read as 300 and be 44, so it stays an error, and the program writes - `n := INT(a) + b`, saying where the work is done in `INT`. - `n := s[i]`, `n * 10 + s[i]` and `f(b)` widen, since a variable, an - element, a field or a call's result is only moved. - -No program changes. `src/` and the library it imports can't use it -until a release makes a new seed, as with 2026-10.26. - -Accepted by the owner, for a thaw. - -Met in libro's `Term`, `Flow` and `Epub`, and rml's `Rml`, wherever -a byte is a number. - -## The width of a character on a terminal - -`Str` says, rightly, that it doesn't know how wide a character is on a -terminal; a program with a screen must, to wrap its lines and to cut -them at the window's edge, and each writes wcwidth again. libro's -`Layout.width` is one: 0 for the combining marks, format characters -and Hangul's medial jamo, 2 for East Asian Wide and Fullwidth, emoji -among them, 1 for the rest, from two sorted tables of ranges (357 and -121) made with Python's `unicodedata`, Unicode 15.1. - -The proposal: a module of the standard library of its own, not `Str`, -which is in the core every target has, with `width(c: I32): INT` and -`columns(s: []U8): INT`. Its tables, about 4 KB, are written by a tool -in `tools/` from Unicode's `EastAsianWidth.txt` and `UnicodeData.txt`, -so that a new version of Unicode is the tool run again. It is the same -answer as glibc's `wcwidth` for nearly every character; the -differences, the ambiguous widths among them, are taken as 1, as most -terminals take them. It gives a character's width, not a cluster's: -an emoji joined by ZWJ, or a flag, comes out as its parts, as it does -in `wcwidth`. - -Accepted by the owner, on one condition: a program that doesn't call -it carries none of it, its tables included. A test shows that first. -It adds a module and breaks no program, so the freeze allows it. - -Met in libro; every program with a screen, rmacs and ravite among -them, needs the same. - ## Less that is undefined Section 10 lists what isn't defined: a stale or made-up pointer,