raz / commit 0c7aae87

commit
0c7aae87b3210a78ff356797b8c8211b17971518
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
37e8670e
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.

patch · log

3 files changed, +20 -18

PROPOSALS.md modified +0 -16

@@ -577,22 +577,6 @@
577577 Met in libro's `Term`, `Flow` and `Epub`, and rml's `Rml`, wherever
578578 a byte is a number.
579579
580-## An array constant's length, from its literal
581-
582-A typed array constant states its length, and its literal must have
583-that many elements (4, 6.5): `Zero: [357]Range = [...]`. A table a
584-program makes, as libro's tables of character widths are made from
585-Unicode's data, must be counted, and the count changed with it; one
586-written by hand is counted by hand. `const T: []INT = [1, 2, 3]` is
587-"only an ERROR, an array or a record constant has a type".
588-
589-The proposal: `[]T` as the type of an array constant, its length the
590-literal's, as a string constant's is the string's; it is used as an
591-array constant of that length is, `LEN` a constant. No program
592-changes.
593-
594-Met in libro's `Layout` and rml's entities, 357, 121 and 253 elements.
595-
596580 ## `Str.free`
597581
598582 `Str.copy(a, s)` gives a copy from the allocator `a`; giving it back

doc/raz.md (history) modified +17 -2

@@ -13,7 +13,7 @@
1313 This report defines the language. It is short on purpose. Whatever it
1414 doesn't allow, raz doesn't have.
1515
16-This is version 2026-10.28 of the report; section 11 says where each
16+This is version 2026-10.29 of the report; section 11 says where each
1717 version's changes are told. 2026-10.11 and 2026-10.12 are a thaw the owner chose,
1818 for a language anyone can build again. They break programs written
1919 for 2026-10.10 and before: for 2026-10.9, say, the report of compiler
@@ -30,8 +30,13 @@
3030 procedure's own frame is an error (section 7.3), which breaks only a
3131 program that read memory already gone. 2026-10.28 mends another: an
3232 array a call returns lives to the end of its statement, and a slice of
33-it kept past that is undefined (sections 8 and 10).
33+it kept past that is undefined (sections 8 and 10). 2026-10.29 is a
34+sixth thaw: an array constant typed `[]T` takes its length from its
35+literal (section 4); it breaks no program.
3436
37+The compiler follows version 2026-10.28 until it has what 2026-10.29
38+adds.
39+
3540 The language is frozen, softly, from this version on: it changes only
3641 to mend a defect, and its library grows only by what breaks no program
3742 written for it. What anyone wishes it had waits on a list, for a later
@@ -384,6 +389,16 @@
384389 compared as its type allows, and passed. Its parts are constant as a
385390 string's bytes are (section 5.10). A part of it isn't a constant, even
386391 at a constant index.
392+
393+An array constant may be typed `[]T`, with no length: its length is
394+then its literal's, as a string constant's is the string's, and it is
395+an array constant of that length, `[n]T`, in all else. Its literal has
396+at least one element.
397+
398+```
399+const Wide: [][2]I32 = [[1100H, 115FH], [2E80H, 303EH], [0AC00H, 0D7A3H]];
400+ Count = LEN(Wide); (* 3, a constant *)
401+```
387402
388403 **Variables** of a module live as long as the program; variables of a
389404 procedure live as long as its call. Both start at zero: every byte of

doc/report-history.md (history) modified +3 -0

@@ -166,3 +166,6 @@
166166 `Sys` gains `entryKind` and `Info.dev`; `spawn` finds a name without
167167 a `/` along `PATH`; over the C library, `syncAll` of a file that
168168 isn't open is -9 (EBADF), as on Linux (volume 2).
169+- **2026-10.29.** A thaw, for tables. An array constant typed `[]T`
170+ takes its length from its literal, and is an array constant of that
171+ length in all else (section 4). It breaks no program.