← board

Named parameters in the Pascal dialect — parked design suggestion

The suggestion

Accept P(name := value) in a Pascal call, binding by parameter name.

Why it is cheaper than it sounds

No name mangling is involved — that framing is wrong, and worth correcting because it makes the idea look harder than it is. pxx already HAS keyword arguments; Pascal not having them is the anomaly within this compiler:

Both operate on the shared Procs[] table (Procs[mpi].Params[k].Name), not on anything NilPy-specific. So this is mostly wiring the Pascal call path into an existing binder.

Compatibility, measured

P(a := 1, 2) is a syntax error in both today:

pxx : error: expected comma or close parenthesis
FPC : Syntax error, ")" expected but ":=" found

The dialect policy would permit it by default: it is case 2 of the two-part rule (FPC rejects it; pxx would give well-defined deterministic semantics → lax by default, parity rejection behind --strict-fpc).

Spelling note: := rather than =, because = is comparison in a Pascal expression and f(a = 1) is genuinely ambiguous with a boolean argument. If FPC ever adds the feature it might pick Ada's =>; accepting both would reconcile.

Why it is PARKED — the argument that decided it (user, 2026-08-10)

  1. it has to be designed well;
  2. it has unintended side effects;
  3. it is not standard Pascal, so no existing Pascal code will ever use it.

(3) is the decisive one, and it defeats the case originally made for it. The argument for the feature was that it removes the pressure that produced the bad file — but the only code that would ever write f(name := value) is pxx-authored wrappers of Python-shaped APIs, and those can simply be written in Python. The feature's entire constituency evaporates, and with it the "fixes the cause" claim.

Reinforcing it: Pascal has its own GUI RTL that works entirely differently, so the typical consumer of a Tk-shaped API is Python code, not Pascal code.

What was done instead

[[feature-b-tkhtmlview-in-nilpy]] — rewrite the offending library in NilPy, where keyword arguments already exist and the library's own consumers already live.

If this is ever revisited

The trigger to watch for is a Pascal-side consumer that genuinely wants keyword arguments — i.e. someone writing Pascal, not a wrapper. Absent that, (3) still holds and this should stay parked.