diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-22 15:07:27 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-22 15:21:14 +0000 |
| commit | f14b50d776ec743bd62fda22a9c154bba9588840 (patch) | |
| tree | 753196ff7881d0bfbcc29834277ffc14e2b4f440 /doc | |
| parent | 8802a5d740d6cff29e473e7e0507b6a6d40a55e4 (diff) | |
feat(codegen)!: reject implicit BOOLEAN, CHAR and INTEGER mixing
Arithmetic and unary minus accept only INTEGER and REAL, AND/OR/NOT need
BOOLEAN, comparisons need equal types (or INTEGER with REAL), and only
INTEGER converts implicitly to REAL. Use ASC and CHR for characters.
No existing test program relied on the now-illegal mixing, so none changed.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/language/cpsc-language-overview.7.md | 2 | ||||
| -rw-r--r-- | doc/language/keyword/cpsc-keyword-and.7.md | 2 | ||||
| -rw-r--r-- | doc/language/keyword/cpsc-keyword-not.7.md | 2 | ||||
| -rw-r--r-- | doc/language/keyword/cpsc-keyword-or.7.md | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/doc/language/cpsc-language-overview.7.md b/doc/language/cpsc-language-overview.7.md index 2106b90..05001bd 100644 --- a/doc/language/cpsc-language-overview.7.md +++ b/doc/language/cpsc-language-overview.7.md @@ -10,7 +10,7 @@ Keywords are uppercase and case-sensitive. Identifiers, including built-in funct Assign with ASCII `<-`: `Count <- Count + 1`. Compare with `=`, `<>`, `<`, `>`, `<=`, and `>=`. Standard-library STRING comparisons compare contents, case-sensitively. Use `+`, `-`, `*`, and `/` for arithmetic; built-in `/` always returns REAL. Use `&` to join strings. -User-defined types can overload operators with OVERLOAD FUNCTION OPERATOR; expressions then use the declared result type. See [cpsc-keyword-operator(7)](keyword/cpsc-keyword-operator.7.md). STRING cannot be implicitly converted to BOOLEAN. +User-defined types can overload operators with OVERLOAD FUNCTION OPERATOR; expressions then use the declared result type. See [cpsc-keyword-operator(7)](keyword/cpsc-keyword-operator.7.md). STRING cannot be implicitly converted to BOOLEAN. Typing is strict: arithmetic and unary minus accept only INTEGER and REAL, a comparison needs operands of the same type (or INTEGER with REAL), and BOOLEAN, CHAR and INTEGER never convert into one another implicitly (only INTEGER converts to REAL). Use ASC and CHR to move between CHAR and INTEGER. Precedence, from highest to lowest: unary operators, `* / DIV MOD`, `+ - &`, comparisons, AND, OR. Parentheses override precedence. diff --git a/doc/language/keyword/cpsc-keyword-and.7.md b/doc/language/keyword/cpsc-keyword-and.7.md index 1577798..7da90b7 100644 --- a/doc/language/keyword/cpsc-keyword-and.7.md +++ b/doc/language/keyword/cpsc-keyword-and.7.md @@ -12,7 +12,7 @@ left AND right # DESCRIPTION -Return BOOLEAN: true when both operands are true. Both operands are evaluated; AND does not short-circuit. AND binds more tightly than OR and less tightly than comparisons. Use parentheses for clarity. +Return BOOLEAN: true when both operands are true. Both operands must be BOOLEAN; numbers and characters are rejected. Both operands are evaluated; AND does not short-circuit. AND binds more tightly than OR and less tightly than comparisons. Use parentheses for clarity. # EXAMPLE diff --git a/doc/language/keyword/cpsc-keyword-not.7.md b/doc/language/keyword/cpsc-keyword-not.7.md index 36a051d..ba55fad 100644 --- a/doc/language/keyword/cpsc-keyword-not.7.md +++ b/doc/language/keyword/cpsc-keyword-not.7.md @@ -12,7 +12,7 @@ NOT expression # DESCRIPTION -Return BOOLEAN with the opposite truth value. NOT is a unary operator; parenthesize comparisons, for example `NOT (Count = 0)`. +Return BOOLEAN with the opposite truth value. The operand must be BOOLEAN. NOT is a unary operator; parenthesize comparisons, for example `NOT (Count = 0)`. # EXAMPLE diff --git a/doc/language/keyword/cpsc-keyword-or.7.md b/doc/language/keyword/cpsc-keyword-or.7.md index df861de..678ff19 100644 --- a/doc/language/keyword/cpsc-keyword-or.7.md +++ b/doc/language/keyword/cpsc-keyword-or.7.md @@ -12,7 +12,7 @@ left OR right # DESCRIPTION -Return BOOLEAN: true when either operand is true. Both operands are evaluated; OR does not short-circuit. OR binds less tightly than AND and comparisons. +Return BOOLEAN: true when either operand is true. Both operands must be BOOLEAN; numbers and characters are rejected. Both operands are evaluated; OR does not short-circuit. OR binds less tightly than AND and comparisons. # EXAMPLE |
