From c2c2e1771bf9b747f38dc145b5201b45c579d465 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Sun, 26 Jul 2026 18:10:10 +0000 Subject: fix: close type-safety holes found by adversarial review; update docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review findings (all reproduced, then fixed and re-verified): - '^x' leaked as a raw address into any builtin context (s <- ^x printed the variable's bytes as a C string; NOT ^x, '&', and ^x = ^x compiled). Address-of is now rejected everywhere except a pointer-typed target. - A whole-array variable passed the nominal gate as a value of its ELEMENT type (s <- arrayOfSeason stored the raw data pointer; = on it emitted invalid IR). Whole arrays are now rejected as operands and as coercion sources; array parameters are unaffected. - Enum values smuggled into INTEGER through array subscripts and DECLARE bounds (a[Autumn], ARRAY[Spring:Winter]); both now go through emitCoercedExpr like every other INTEGER context. - An array DECLAREd inside an IF/WHILE/REPEAT/FOR body and used after the block was a wild-pointer write (constant bounds) or a verifier dump (runtime bounds). Arrays are now block-scoped: control-flow bodies snapshot and restore the ArrayTable, so escape is a clean compile error. - Duplicate parameter names silently shadowed (BYREF write-back defeated); now a parse error. Trailing comma in parameter lists accepted; now a parse error consistent with every other list. - A variable/array/parameter/function could reuse a TYPE name; reserved. - RETURN with a value inside a PROCEDURE was silently discarded (control did not return); now an error, as is a bare RETURN in a FUNCTION. - INPUT r.f mis-parsed into a three-error cascade; now one clear error. - Assigning to an enum constant now says so instead of 'Unknown variable'. Docs: ARCH/CONVENTIONS/EXTENDING/SUBSYSTEMS/PITFALLS rewritten for the TYPE system (ABI additions, nominal-typing invariants, admission-gate doors, array-parameter ABI, new recipes, new sharp edges); README features/TODO updated — random files are unblocked. Co-Authored-By: Claude Fable 5 --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 79250d2..dd08059 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,21 @@ IDK WHAT HAPPENDED IT IS 100% AI-GENERATED DO NOT OPEN ANY ISSUES JUST CLONE AND - text file handling (OPENFILE/READFILE/WRITEFILE/CLOSEFILE/EOF) with runtime misuse checking (wrong mode, not open, read past EOF, ... all die with a clean `[Fatal]` message instead of corrupting anything) +- user-defined types (CIE §4): enumerated types (with runtime range checking on + `enum ± INTEGER`), pointers (`^x` / `p^`, strict nominal typing, null-deref dies + with `[Fatal]` instead of segfaulting — linked lists work, `TYPE NodePtr = ^Node` + may forward-reference), records (nested, arrays of records, `Form[i].Field <- x`) +- whole arrays and records as FUNCTION/PROCEDURE parameters (`ARRAY OF T` or + `ARRAY[l:u,...] OF T` as a checked contract; BYVAL really copies), with the + spec-correct sticky BYREF/BYVAL and BYREF-is-procedure-only rules from §8.3 - ultra-fast compiling & executing ## TODO - search for `TODO` in my code -- type -- random files (OPENFILE FOR RANDOM / SEEK / GETRECORD / PUTRECORD) — needs `type` first +- random files (OPENFILE FOR RANDOM / SEEK / GETRECORD / PUTRECORD) — `type` is done, unblocked +- SET types (`SET` / `DEFINE` are reserved and give a clear "not implemented" error) +- CASE OF, CONSTANT, DATE ## Dependencies -- cgit v1.3.1-4-g156e