# demo33 — corpus differential harness, CHANGE, paths with parens, arg types

Build marker: `demo33-2026-11-28`.

## Baseline (all green)

| check | result |
|---|---|
| golden suite, native Linux | **93/93** |
| golden suite, Windows PE under Wine | **93/93** |
| re-bol.com corpus (20 sections) | **325 snippets, 0 errors** (Linux + Wine) |
| examples / net / ports (`--mix`) smoke | PASS native + Wine |
| GUI screenshot regression | 3/3, 0.00 % diff |

## 1. New: corpus differential harness (`--diff`)

`tools/examples_sections.py --diff [--section NAME]` runs each section through
the **reference** and the clone and reports the first differing output lines
(with the `--@<snippet line>` marker that precedes each one).  To make that
possible:

* the result file is now written **after every snippet**, so a stall in the
  reference still leaves a comparable prefix;
* the reference uses a *relative* result path (it cannot write
  `to-file "Z:/..."` — that lands in its error console);
* the prelude gained a deterministic, type-preserving `random` stub and its
  `now` stub no longer uses `to-date` of an integer (R2 errors on that) so the
  reference can run the same script;
* snippets that are *supposed* to raise (the reference errors too, e.g. the
  type-check demo) are marked `ERROR (expected)` and not counted as failures.

The first sweep found (and this release fixes):

## 2. `change` on strings: default range is the new text's length

```
change copy "Tom" "Phil"        -> "Phil"     (was "Philom")
change copy "Tom" "Ph"          -> "Phm"
change copy "abcdef" [1 2 3]    -> "123def"
change copy "Tom" 12            -> "12m"
change copy "abcdef" change/part "XY" 4 -> "XYef"
```
R2 replaces `length? new-text` characters (blocks still replace one element).
Golden `93-change-default-range`.

## 3. Paths with paren components

`b/(i)`, `o/(w)`, `m/(j)/(1)` and the set-path forms `b/(i): value`,
`m/(j)/(1): value` now scan, evaluate and mold like R2 (`path/(expr)` was
interpreted as a plain paren part and the set-path form even broke the
scanner).  Golden `91-path-paren-forms`.

## 4. Directory listings are sorted

`read %dir/` returns the names sorted case-insensitively (the corpus
`foreach file (read %./)` example exposed the difference).

## 5. User-function argument type checking

R2 checks the `[types...]` block of every argument at call time:

```
f1: func [a [integer!]] [a]
f1 "x"   -> ** Script Error: f1 expected a argument of type: integer
```
and also errors for a missing argument.  The clone ignored both.  Type blocks
are now parsed per argument (positional and refinement), the datatype words in
them are normalised to datatype values (which is why HELP prints
`(Type: integer)` without the `!`), and R2's typeset names (`series!`,
`number!`, `any-string!`, `any-word!`, `any-path!`, `any-block!`,
`any-function!`, `any-type!`) are matched by name.  Golden
`92-arg-type-checks`.

The FUNCTIONS corpus section now differs from the reference on one cosmetic
line only (which word `first system/words` yields in a HELP demo).
