raz / commit 4fb20c27

commit
4fb20c279b82cb553cac8024f6594427aebd1903
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
09da0cd0
PROPOSALS: drop the four v0.17.0 built

Enumerations' names, continue, a byte into an INT, Width: all in
report 2026-10.31.

patch · log

1 file changed, +0 -139

PROPOSALS.md modified +0 -139

@@ -369,145 +369,6 @@
369369 procedure values) take years; the narrow form here leaves record
370370 lifetimes out, and so the first false alarm above, on purpose.
371371
372-## Enumerations' names, each its own
373-
374-An enumeration's names are declared in the scope around its type
375-(5.7), so two enumerations of a module can't share a name, nor a
376-procedure have one: with `Style = (bold, italic, ...)`, a second
377-`Elem = (..., bold, ...)` is "bold is declared twice", and so is
378-`proc rule` beside `Kind = (para, rule)`. A module with two lists of
379-kinds, a style and the HTML element that makes it, names one of them
380-again: libro's `Flow` has `bEl`, `iEl`, `pEl`, ... for it.
381-
382-The proposal: a name of an enumeration may always be written with its
383-type, `Elem.bold`; and a name that two enumerations of a scope share,
384-or an enumeration and something else, must be, everywhere. A name only
385-one enumeration has stays as it is. The type is never guessed from
386-where the name stands, so the compiler's lookup stays a lookup: a name
387-it finds twice is an error that says to write the type. Taking the
388-type from the place (`match` on a `Style`, a `Style` assigned) could
389-come later, and would break nothing. No program changes, since every
390-program today has each name once.
391-
392-Accepted by the owner, for a thaw.
393-
394-Met in libro's `Flow`.
395-
396-## `continue`
397-
398-`break` leaves a loop; nothing goes on to its next round. A loop that
399-passes over some of what it reads (a byte to skip, an entry that
400-doesn't match) puts the rest of its body in an `if`, or a flag, and a
401-loop with several such tests grows a level of `if` for each:
402-
403-```
404-while i < LEN(t) do
405- ch, n := Str.decode(t[i..LEN(t)]);
406- if ch = 0ADH then
407- (* passed over *)
408- elsif ... then
409- end;
410- i := i + n;
411-end;
412-```
413-
414-The proposal: `continue`, in a `while`, `repeat` or `for`, ends the
415-round, as reaching the end of the body would: a `while` tests its
416-condition again, a `repeat` tests its `until`, a `for` steps its
417-variable. A deferred statement can't hold it, as it can't hold
418-`break`. With it, the loop above reads:
419-
420-```
421-while i < LEN(t) do
422- ch, n := Str.decode(t[i..LEN(t)]);
423- i := i + n; (* the step first *)
424- if ch = 0ADH then continue; end; (* passed over *)
425- ...
426-end;
427-```
428-
429-The step comes before any `continue`. Put after it, as `i := i + n`
430-stood in the first loop, it is skipped, `i` never moves, and the loop
431-never ends; a `repeat`'s `until` may likewise read what the skipped
432-rest of the body was to set. A `for` steps itself and has neither
433-trap. The report's example shows the step first, and the compiler
434-can't catch it.
435-
436-It costs about 15 lines of the compiler (a second chain of jumps
437-beside `break`'s, fixed at each loop's test or step), a few lines of
438-the report (7.2, the reserved words, the grammar, 7.7), and a word in
439-`tools/Scan.raz` and the editors' modes. It breaks a program that has
440-a name `continue`; none of the raz programs written so far has one.
441-
442-Accepted by the owner, for a thaw.
443-
444-Met in libro and rml, more than once each, and in concha's
445-`Csyntax`, whose `interpolate` reads `elsif (c # '$') or not try
446-dollar(...)` for want of it.
447-
448-## A byte into an `INT`
449-
450-A `U8` doesn't go into an `INT` without a conversion, though no value
451-of one is lost there: `c := keys[at]` is "can't use U8 as INT", and a
452-parser of digits writes `INT(s[i]) - '0'` at every digit. 2026-10.26
453-made `INT` widen to `I64` wherever it meets one, for the same reason;
454-the small types into `INT` are the same, and more common.
455-
456-The proposal, in three parts:
457-
458-- `INT` and `UINT` are at least 16 bits, on every target (5.1).
459-- `U8`, `I8` and `I16` widen to `INT`, and `U8` and `U16` to `UINT`,
460- where their value goes to one: assigned, passed, returned, in
461- `a, b := f(x)`, a `for`'s bounds, `INC` and `DEC`'s step, and in an
462- operator that meets an `INT`, as `INT` to `I64` does (5.10). These
463- are the types an `INT` holds whole on every target, so a program
464- that compiles on one compiles on all. `U16`, `I32` and `U32` still
465- need `INT(x)`; were `INT` at least 32 bits, `U16` and `I32` would
466- join, and the minimum can be raised later, never lowered.
467-- What an operator gives on two narrow operands doesn't widen. raz
468- works in the operands' type, so with `a, b: U8`, `a + b` is a `U8`
469- that wraps: 200 + 100 is 44. Widened silently, `n := a + b` would
470- read as 300 and be 44, so it stays an error, and the program writes
471- `n := INT(a) + b`, saying where the work is done in `INT`.
472- `n := s[i]`, `n * 10 + s[i]` and `f(b)` widen, since a variable, an
473- element, a field or a call's result is only moved.
474-
475-No program changes. `src/` and the library it imports can't use it
476-until a release makes a new seed, as with 2026-10.26.
477-
478-Accepted by the owner, for a thaw.
479-
480-Met in libro's `Term`, `Flow` and `Epub`, and rml's `Rml`, wherever
481-a byte is a number.
482-
483-## The width of a character on a terminal
484-
485-`Str` says, rightly, that it doesn't know how wide a character is on a
486-terminal; a program with a screen must, to wrap its lines and to cut
487-them at the window's edge, and each writes wcwidth again. libro's
488-`Layout.width` is one: 0 for the combining marks, format characters
489-and Hangul's medial jamo, 2 for East Asian Wide and Fullwidth, emoji
490-among them, 1 for the rest, from two sorted tables of ranges (357 and
491-121) made with Python's `unicodedata`, Unicode 15.1.
492-
493-The proposal: a module of the standard library of its own, not `Str`,
494-which is in the core every target has, with `width(c: I32): INT` and
495-`columns(s: []U8): INT`. Its tables, about 4 KB, are written by a tool
496-in `tools/` from Unicode's `EastAsianWidth.txt` and `UnicodeData.txt`,
497-so that a new version of Unicode is the tool run again. It is the same
498-answer as glibc's `wcwidth` for nearly every character; the
499-differences, the ambiguous widths among them, are taken as 1, as most
500-terminals take them. It gives a character's width, not a cluster's:
501-an emoji joined by ZWJ, or a flag, comes out as its parts, as it does
502-in `wcwidth`.
503-
504-Accepted by the owner, on one condition: a program that doesn't call
505-it carries none of it, its tables included. A test shows that first.
506-It adds a module and breaks no program, so the freeze allows it.
507-
508-Met in libro; every program with a screen, rmacs and ravite among
509-them, needs the same.
510-
511372 ## Less that is undefined
512373
513374 Section 10 lists what isn't defined: a stale or made-up pointer,