Skip to main content
Reference for every type declaration form in Kairo v0.1: value, object, contract, and enum, plus the visibility modifiers and construction forms that go with them.

Visibility modifiers

All declaration keywords accept a visibility modifier prefix.

value

Declares an immutable, identity-free type. Syntax
Rules
  • Value members must be value-like.
  • Members are immutable by default.
  • No init block; values are assembled with a field block.
  • May declare instance methods, type funcs, and conform to contracts.
Example

object

Declares an identity-bearing type. Syntax
Rules
  • Members are immutable by default; use var for mutable members.
  • Required immutable members must be assigned in init.
  • Exactly one primary init in v0.1; no constructor overloading.
  • May declare instance methods, type funcs, and conform to contracts.
Example

contract

Declares a capability contract that types can conform to. Syntax
Rules
  • Contracts declare requirements only. No stored fields, no init, no method bodies, no type func.
  • May require methods, read-only properties, and read-write properties.
  • May be generic and may declare contract constraints on type parameters.
  • Enum conformance, default implementations, and generic contract conformance are deferred.
Example

Contract conformance

Declares that a value or object satisfies one or more contracts. Syntax
Rules
  • Conformance is always explicit.
  • Forge verifies every required member is present with a matching signature.
  • Each contract in the list must resolve to a contract type.
Example

enum

Declares a finite, named set of cases. Syntax
Rules
  • Case names must be unique within the enum.
  • Enum cases are PascalCase.
  • Case payloads (associated values) are deferred in v0.1.
  • match on enum cases follows the exhaustiveness rules described in Operators.
Example

Members

Member field

Value members must be value-like. Object members may store any type. Mutable members require var.

Computed property

get is required for readable properties. set accepts a single value parameter matching the property type. Kairo does not auto-generate getters or setters in v0.1.

Construction

Value construction

All required fields must be supplied exactly once.

Object construction

Arguments must be named. There is no positional-only form for object construction in v0.1.

Types (language guide)

The value/object model in prose.

Command Catalog

Every construct in a scannable table.