Skip to content
Beskid The Beskid Book

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

07.4 Functions and methods

Functions, methods, contracts, and calls without nullable receivers."

Functions and methods

Functions do work. Methods attach behavior to types. Contracts document what callers may assume—read the platform spec before treating this page as law.

Top-level and scoped functions declare parameters and return types (inference may fill gaps where allowed). Keep signatures honest at API edges—internals can be messier, but not Option-as-error-swallowing messier.

Instance methods dispatch on nominal types per method dispatch. Possibly-absent receivers use Option<T> + match, not null checks.

Public APIs often use contracts (interfaces) with documented effects—see contracts and error handling.

/// on functions may use @arg on parameters. Do not slap @arg on record fields because you were bored.

string greet(string name) {
return "hello " + name;
}

Exact syntax keywords evolve—verify against spec if copy-paste fails parse.

Control flow