-
Notifications
You must be signed in to change notification settings - Fork 3
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) andconstreferences - 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.
This wiki mirrors the language reference at kairolang.org/docs. To edit a page, edit the source at kairo-web/src/content/docs/language changes sync automatically.
Start here: Primitives
1. Fundamentals
2. Functions & Control Flow
3. Types
4. Modules & Metaprogramming
5. Memory & Safety
6. Interop & Concurrency