From 7849597f2b1d4035fd36e4411a0fffdd42cbd952 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Fri, 23 Oct 2026 11:55:09 +0100 Subject: [PATCH] raz.md: INT(b), a BOOL as an integer --- diff --git a/doc/raz.md b/doc/raz.md index 01e5d49..e13dc20 100644 --- a/doc/raz.md +++ b/doc/raz.md @@ -52,7 +52,7 @@ rotated (sections 6.1 and 6.8); it breaks no program. 2026-10.36 is a twelfth: `MIN(T)` and `MAX(T)`, the limits of an integer type, and `CLZ`, `CTZ` and `POPCOUNT`, which count bits (sections 6.1 and 6.8); -it breaks no program. +and `INT(b)`, a `BOOL` as an integer (section 6.7); it breaks no program. 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 @@ -939,18 +939,21 @@ | `F64` | `F32` | the nearest `F32`; too big a value gives an infinity | | enumeration | integer | its position | | integer | enumeration | the name at that position; a position out of range is a failed check (6.5), and in a constant an error | +| `BOOL` | integer | 0 for `false`, 1 for `true` | | set | integer | its bits | | integer | set | the low bits, as many as the set has | | `INT`, `UINT` | pointer, procedure | the address | | pointer, procedure | `INT`, `UINT` | the address | | pointer, procedure | pointer, procedure | the same address, seen as the new type | -There are no others: no conversion between `BOOL` and integers, none -between pointers and integers other than `INT` and `UINT`, and none to +There are no others: none from an integer to `BOOL` (`x # 0` says it), +none between pointers and integers other than `INT` and `UINT`, and none to or from records, arrays, slices, variants or `ERROR`. An untyped integer constant converts to a pointer as an `INT` does, as in `^VOLATILE U32(0FEE00000H)`; it isn't assigned to a pointer without the conversion. A conversion of a constant is made by the compiler, by -the same rules: `U8(300)` is 44. +the same rules: `U8(300)` is 44. `U64(a = b)` is 0 or 1, and +`0 - U64(a = b)` is a mask; this is how a comparison is used with no +`if`. ### 6.8 Built-in procedures diff --git a/doc/report-history.md b/doc/report-history.md index a81913f..011f94a 100644 --- a/doc/report-history.md +++ b/doc/report-history.md @@ -240,3 +240,6 @@ bits (or members of a set) of a word of an unsigned integer type, an `INT`, and of constants are a constant (sections 4, 6.1 and 6.8). A predeclared name may be hidden (section 2), so it breaks no program. + A `BOOL` also converts to an integer, 0 for `false` and 1 for `true` + (6.7), a constant too; there is still none from an integer to a + `BOOL`. It breaks no program.