module declaration that names a file’s module, and the import forms you use to bring other modules into scope.
module Declaration
The module declaration names the module that a .ak file belongs to. It must appear as the first non-comment line of the file, before any imports or declarations.
- Every
.akfile must have exactly onemoduledeclaration. - The module name is a dot-separated sequence of PascalCase identifiers (e.g.,
Astra.Data,My.App.Domain). - Multiple files in the same directory can share the same module name — the module spans all of them.
- The module name is the canonical identity of the code. The filesystem path is not authoritative.
Module names are case-sensitive and every segment must be PascalCase. A name like
astra.data or Astra.data is invalid.import Declaration
Use import to bring another module into scope. Kairo does not support wildcard imports — you always import a whole module by its full name.
Astra.Data using its fully qualified name.
Rules:
- Imports must appear after the
moduledeclaration and before any type or function declarations. - You can import as many modules as you need, one
importper line. - There are no wildcard or selective imports — the entire module is imported.
import … as Alias
When a module name is long or conflicts with a local name, give it a shorter alias using as.
import type Declaration
Use import type when you need to import only a specific type from a module and want to make that intent explicit. This form is useful when two modules export types with the same name and you need to clarify which one you mean.
import typeimports a single named type, not a whole module.- The name after
import typeis the fully qualified type name. - Use this form to resolve ambiguity when multiple imported modules define a type with the same short name.
import type does not replace a full module import. If you also need other declarations from that module, add a separate import line for the module itself.