Skip to main content
Reference for module, import, import ... as, and import type declarations.

module

Declares the logical module a source file belongs to. Syntax
Rules
  • Exactly one module declaration per .ak file.
  • Must be the first non-comment line.
  • Segments use PascalCase; the full name uses dot separators.
  • Multiple files may contribute to the same module.
  • File paths are conventions only. The module declaration is authoritative.
Example

import

Imports a module into the current file’s scope. Syntax
Rules
  • Must appear after module and before declarations.
  • No wildcard imports.
  • Importing a module makes its public members accessible by name.
Example

import ... as

Imports a module under a local alias. Syntax
Rules
  • The alias is file-local. It does not create a new module identity.
  • Alias must be unique within the file’s import scope.
  • Alias identifiers follow the same casing rule as the module segment they replace.
Example

import type

Imports a specific type by name, not a whole module. Syntax
Rules
  • Target must resolve to a type when metadata is available.
  • Useful when the file only needs a specific type and not the whole module.
  • Removes any ambiguity between module names and type names.
Example

Ordering and placement

Every .ak file follows the same order:
1

module

Exactly one module declaration.
2

imports

Zero or more import, import ... as, or import type statements.
3

declarations

Types, functions, and other members.

Diagnostics

Common Forge diagnostics related to modules and imports:
  • Missing module declaration.
  • module declaration not first in the file.
  • Wildcard import used (not supported in v0.1).
  • Alias already declared in this file.
  • Type import target does not resolve to a type.

Language syntax

Higher-level guide to modules and imports.

Command Catalog

Spec-style entries for every construct.