Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Method dispatch

Platform spec node

Method dispatch

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

Defines how member access (receiver.method(args)) and free functions resolve to callable targets. Type shapes come from Types; symbols from Name resolution.

  • Instance calls use postfix .Identifier after a primary expression that denotes a value type.
  • The receiver’s static type must expose a callable member with matching name and signature, or the call must error (E1101, E1213).
  • extend type members participate in the member set of the extended type with the same visibility rules as declared members.
  • Overloading must be resolved by arity and argument types at the call site; there is no ad hoc ranking beyond signature match.
  • Ambiguous overload sets must error rather than pick a candidate.
  • Contracts used as namespaces (Contract.method()) follow resolver fallback for contract-as-namespace calls.
  • Legacy impl Receiver { … } blocks may still parse; new code should use extend type per extend type.
  • Methods in impl / extend type must obey visibility and access rules of the target type.
  • Dispatch is static in v0.1: the callee is known at compile time from the receiver’s static type (no virtual table polymorphism for user classes unless introduced by a future decision).
  • Interop thunks must preserve the statically selected symbol through lowering.

Resolution E1101; type/call E1204–E1205; invalid member E1213. Registry: Diagnostic code registry.

Call resolution tests in beskid_analysis must pass for L2 claims.

  • D-LM-DISP-001 — Static dispatch default: v0.1 uses compile-time member selection; dynamic polymorphism is deferred.
  • D-LM-DISP-002 — extend over impl: extend type is the normative extension syntax; impl remains parse-compatible during migration.
  • D-LM-DISP-003 — Receiver static type: Dispatch keys off the static type of the receiver expression, not runtime tags.
  • D-LM-DISP-004 — No null receiver: Calls on possibly-absent values must use Option<T> and match, not null checks.

Virtual dispatch, overload resolution, and receiver rules decide which code runs. Interop and codegen consume the same dispatch table model.