summary_step5.5.md 1.6 KB

V3 step 5.5 — library showcase (done 2026-09-22)

tests/showcase11.mod tours every standard library in one separate-compilation session. Suite 95/95.

Session

showcase11.mod + all six libraries (sysio, textio, wholeio, strings, math, files) built and linked into one image, run with stdin 42.

Output

Modula-2
8
42
12
42

Exit 80. Verified by expect_run_files_in (Showcase11 → 80 [Modula-2], stdin 42).

What it exercises

  • Strings — Assign ×2, Concat → "Modula-2", Length → 8.
  • WholeIO — ReadCard from stdin (42).
  • TextIO — WriteCard echoes it.
  • Math — sqrt(144.0) + Pi - Pi → 12.
  • Files — OpenWrite, two WriteChar, Close, OpenRead, ReadInt → 42.
  • SysIO — Write (string) + WriteInt/WriteLn.
  • Exit code — n - 12 + Length(u) + card = 42-12+8+42 = 80.

Constraint discovered while writing it

Because qualified access flattens names into the client scope, two libraries exporting the same routine name (e.g. TextIO.WriteInt and Files.WriteInt) cannot both be used in one scope — the second resolves to the first. The showcase sidesteps this by using each library's distinct names (the materialized set is collision-free: Write/WriteInt/WriteLn/WriteCard/ReadCard/ OpenWrite/WriteChar/Close/OpenRead/ReadInt/Assign/ Concat/Length/sqrt/Pi). This is the concrete trigger for the symbol-naming / real-qualified-resolution pass recorded in docs/session-2026-09-22-step5.md; until then, callers must avoid same-named imports from two modules.