← board

Procedural types and method pointers

Motivation

The async arc needed a way for a library Spawn/CoStart to call a coroutine body entry(arg) — but PXX could not call a proc-typed variable with arguments (p(42) was a parse error). Rather than a per-target asm entry shim, we added real procedural types (standard Pascal, reusable everywhere: callbacks, event handlers, dispatch tables) — which then made CoStart pure library.

Delivered

Mechanism: AN_CALL_IND/IR_CALL_IND; the signature is a body-less Procs[] entry referenced by parallel arrays AliasProcSig / SymProcSig (per the TSymbol-field landmine). Tests test/test_proctype.pas (test-core + test-i386) and test/test_methcall.pas (test-core).

Landmines (recorded)

Acceptance

v(args) through a proc-typed variable calls correctly (statement + expression, all 4 targets); @obj.Method method pointers call with Self on x86-64; bootstrap

Log