From 0c7aae87b3210a78ff356797b8c8211b17971518 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Fri, 16 Oct 2026 07:17:03 +0000 Subject: [PATCH] Report 2026-10.29: an array constant typed []T takes its literal's length A sixth thaw, by the owner's word, met in libro's and rml's tables of 357, 121 and 253 elements, made by a program and counted by hand. An array constant may be typed []T: its length is its literal's, as a string constant's is the string's, and it is an array constant of that length in all else, LEN a constant (section 4). It breaks no program. The compiler follows 2026-10.28 until it has it. --- diff --git a/PROPOSALS.md b/PROPOSALS.md index 429c293..9b44f96 100644 --- a/PROPOSALS.md +++ b/PROPOSALS.md @@ -577,22 +577,6 @@ Met in libro's `Term`, `Flow` and `Epub`, and rml's `Rml`, wherever a byte is a number. -## An array constant's length, from its literal - -A typed array constant states its length, and its literal must have -that many elements (4, 6.5): `Zero: [357]Range = [...]`. A table a -program makes, as libro's tables of character widths are made from -Unicode's data, must be counted, and the count changed with it; one -written by hand is counted by hand. `const T: []INT = [1, 2, 3]` is -"only an ERROR, an array or a record constant has a type". - -The proposal: `[]T` as the type of an array constant, its length the -literal's, as a string constant's is the string's; it is used as an -array constant of that length is, `LEN` a constant. No program -changes. - -Met in libro's `Layout` and rml's entities, 357, 121 and 253 elements. - ## `Str.free` `Str.copy(a, s)` gives a copy from the allocator `a`; giving it back diff --git a/doc/raz.md b/doc/raz.md index 358a8a2..7de68ca 100644 --- a/doc/raz.md +++ b/doc/raz.md @@ -13,7 +13,7 @@ This report defines the language. It is short on purpose. Whatever it doesn't allow, raz doesn't have. -This is version 2026-10.28 of the report; section 11 says where each +This is version 2026-10.29 of the report; section 11 says where each version's changes are told. 2026-10.11 and 2026-10.12 are a thaw the owner chose, for a language anyone can build again. They break programs written for 2026-10.10 and before: for 2026-10.9, say, the report of compiler @@ -30,8 +30,13 @@ procedure's own frame is an error (section 7.3), which breaks only a program that read memory already gone. 2026-10.28 mends another: an array a call returns lives to the end of its statement, and a slice of -it kept past that is undefined (sections 8 and 10). +it kept past that is undefined (sections 8 and 10). 2026-10.29 is a +sixth thaw: an array constant typed `[]T` takes its length from its +literal (section 4); it breaks no program. +The compiler follows version 2026-10.28 until it has what 2026-10.29 +adds. + The language is frozen, softly, from this version on: it changes only to mend a defect, and its library grows only by what breaks no program written for it. What anyone wishes it had waits on a list, for a later @@ -384,6 +389,16 @@ compared as its type allows, and passed. Its parts are constant as a string's bytes are (section 5.10). A part of it isn't a constant, even at a constant index. + +An array constant may be typed `[]T`, with no length: its length is +then its literal's, as a string constant's is the string's, and it is +an array constant of that length, `[n]T`, in all else. Its literal has +at least one element. + +``` +const Wide: [][2]I32 = [[1100H, 115FH], [2E80H, 303EH], [0AC00H, 0D7A3H]]; + Count = LEN(Wide); (* 3, a constant *) +``` **Variables** of a module live as long as the program; variables of a procedure live as long as its call. Both start at zero: every byte of diff --git a/doc/report-history.md b/doc/report-history.md index 4d60537..c93c4de 100644 --- a/doc/report-history.md +++ b/doc/report-history.md @@ -166,3 +166,6 @@ `Sys` gains `entryKind` and `Info.dev`; `spawn` finds a name without a `/` along `PATH`; over the C library, `syncAll` of a file that isn't open is -9 (EBADF), as on Linux (volume 2). +- **2026-10.29.** A thaw, for tables. An array constant typed `[]T` + takes its length from its literal, and is an array constant of that + length in all else (section 4). It breaks no program.