summary_showcase19.md 2.3 KB

Session summary — 2026-09-29 (c): CLASS finished + showcase19

Suite 147/147; self-hosting fixpoint OK (image 2,313,762 bytes). master, tree clean except the user's uncommitted compiler/toto.mod.

This session closed out the Clarion CLASS feature, then showcased it.

Steps, tags and headline commits

Step Tag Commit What
CLASS finished v3-class-finish 3804256 sibling method calls + init body
Showcase v3-showcase19 (this commit) init body + sibling-call chains

1. CLASS finished

Two 230s removed (the third, multiple parents, stays by design):

  • Sibling-method calls — inside a CLASS IMPLEMENTATION, a bare method name is a call on THIS. SymTab tracks the innermost open implementation (implStk/CurImplClass); Design binds an otherwise-unresolved name to the class's method and arms THIS as the receiver. A virtual sibling still dispatches through the vtable.
  • Class BEGIN … END init body — emitted as <Class>_init, registered with the module init functions, and run once at startup. (A body touching instance fields still reports 230: there is no receiver, and V3 has no class statics.)

docs/summary_class-finish.md.

With this, CLASS is ✅ for: fields, methods (value/VAR formals, results), single inheritance, WITH, hidden THIS, VIRTUAL dynamic dispatch (vtables) with subtype pointers, sibling calls, and init bodies. ⏸ multiple parents only.

2. Showcase

compiler/tests/showcase19.mod (Showcase19, exit 42):

  • Accumulator's BEGIN body sets a global scale := 10 at startup.
  • AddPair → AddScaled → Add is a chain of sibling calls on THIS; AddScaled uses the init-set global.
  • The result is rendered with Conversions.IntToStr + CHAR-array +.

    showcase19 total=42
    

Tests (147, was 146)

New: Showcase19 (42). (The class-finish step added t_classsibling and t_classinit and promoted t_class.)

Resume

cd .../m2compiler-V3
./bootstrap/fixpoint.sh                       # FIXPOINT OK
cd compiler && ./build.sh && ./run_tests.sh   # 147/147

Remaining polish

  • Multiple parents (deliberate).
  • VAL(LONGINT|REAL, x) and long→int narrowing.
  • More stdlib (SysClock, richer Strings/Math).