Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Control flow

Platform spec node

Control flow

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

Defines statement-level control flow and structured transfer. Expression-level match is in Enums and match.

ConstructRule
if (cond) block else blockcond must be bool (non-bool condition diagnostic)
while (cond) blockcond must be bool; body may loop
for id in expr blockexpr must be iterable per type rules (v0.1: range and array-like forms as implemented)
return expr?;Returns from the innermost function; expr must match return type when present
break; / continue;Must appear inside a loop; otherwise E1401 / E1402
let / typed letIntroduces locals; see Type inference
  • Function arguments must be evaluated left to right before the call.
  • Binary operators must evaluate left operand before right for && and || with short-circuit semantics.
  • Assignment must evaluate the right-hand side before storing.
  • Unreachable code after unconditional transfer may warn (W1403).
  • HIR lowering must normalize control flow graphs (E1154 if non-normalized).
  • if and while execute the taken branch block sequentially.
  • break exits the innermost while/for; continue jumps to the next iteration.

Control band E1401–E1403; bool condition errors in type band. Registry: Diagnostic code registry.

L3 semantic tests for break/continue and return paths must pass.

  • D-LM-CF-001 — No switch statement: Sum-type branching uses match expressions only.
  • D-LM-CF-002 — Short-circuit booleans: && and || are mandatory short-circuit operators.
  • D-LM-CF-003 — bool conditions only: if/while must not treat non-bool values as truthy (no C-style 0 truthiness).
  • D-LM-CF-004 — Structured transfer only: goto is not in the grammar; use break/continue/return.

Conditionals, loops, and structured control transfer. Lowering to HIR/CLIF follows the evaluation order defined here.