Skip to content

Ownership

kairo-docs-bot edited this page May 27, 2026 · 7 revisions

Ownership

Important

This page is under development. The ownership model is being finalized alongside AMT. Full documentation will be added once the design is complete.

Kairo's ownership model governs how values are created, moved, borrowed, and destroyed. It works in conjunction with AMT to provide memory safety without lifetime annotations.

Key concepts that will be covered on this page:

  • Move semantics and when values are moved vs copied
  • Borrowing rules for safe pointers (*T) and const references
  • How const [T] acts as a non-owning view (cap set to zero, no growth, no deallocation)
  • Interaction between ownership and closures (capture by copy vs by reference)
  • How classes implement the rule of five
  • How structs are always trivially copyable via memcpy
  • The mref!() intrinsic for rvalue references

See AMT for the compile-time analysis that enforces ownership rules, and Unsafe for opting out of ownership tracking.

Start here: Primitives


1. Fundamentals

2. Functions & Control Flow

3. Types

4. Modules & Metaprogramming

5. Memory & Safety

6. Interop & Concurrency


Website · Docs · Repo

Clone this wiki locally