Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Contracts

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

Defines contract declarations — structural interfaces that types implement via conformance lists. This is distinct from compiler Mod contracts (Compiler Mod SDK).

contract Disposable
{
unit Dispose();
}
  • contract Name { items } declares required members.
  • Items may be method signatures (T name(params);) or embeddings (OtherContract;) that flatten member requirements.
  • Types declare implementation with type T : I, J { … }.
  • Implementing types must supply every required member with compatible signature (E1601, E1602, E1606).
  • Conflicting embedded contract methods must error (E1004).
  • Duplicate contract method names in one contract must error (E1003).
  • Invalid conformance targets must error (E1607).
  • Contract calls use static dispatch on the receiver’s type after conformance is proven.
  • Contracts may be used as namespaces for static-style calls when the resolver provides contract-as-namespace fallback.

Contract band E1601–E1607. Registry: Diagnostic code registry.

All Standard types advertising conformance must pass contract satisfaction in the reference compiler.

  • D-LM-CON-001 — Structural contracts: Beskid contracts are nominal surfaces checked structurally, not runtime interface tables in v0.1.
  • D-LM-CON-002 — Embedding: Contract embedding composes requirements without inheritance syntax.
  • D-LM-CON-003 — No requires/ensures in v0.1: Design-by-contract assertions are deferred; contract items are interface shapes only.
  • D-LM-CON-004 — Distinct from Mod SDK: Compiler mod contract placements follow Compiler Mod SDK, not this user-language surface.

Structural contract declarations and type conformance lists. Compiler mods and optional future runtime contract checks are specified elsewhere.