Imports cross module boundaries. Atoll supports named imports and module
imports; paths are unquoted and use / between directory segments.
Import paths identify canonical project modules. They are not filesystem strings, so they are not quoted and are not resolved relative to the importing file’s directory.
Named imports
A named import places selected exported declarations directly in local scope.
import { Booking, Customer } from workreef.dev/seaport/core/models
fn customer_id(customer: Customer): int {
return customer.id
}Braces are required by the current style even though the parser retains the older unbraced form for compatibility.
Rename one imported declaration with as:
import {
Booking as StoredBooking,
Customer
} from workreef.dev/seaport/core/modelsThe alias is local to the importing file. Use it to resolve collisions, not to hide a poorly named public API.
Named imports fail when the requested declaration does not exist, is private, or collides with another local binding. Import only the names the file uses; this keeps the dependency visible at the point of reference.
Module imports
A module import creates a namespace. Its default local name is the last path segment.
import workreef.dev/seaport/core/models
fn lookup(id: int): models.Booking {
return models.find_booking(id)
}Rename the namespace when two paths have the same tail or when the tail is too generic:
import workreef.dev/seaport/core/models as core
import workreef.dev/seaport/admin/models as adminMembers are reached with dot syntax: core.Booking, core.find_booking(id).
The namespace alias itself occupies a local name. Two unaliased module paths with the same final segment therefore conflict:
import workreef.dev/seaport/core/models as core_models
import workreef.dev/seaport/admin/models as admin_modelsModule imports are useful when an API has many related names or when the namespace makes call sites clearer. Named imports are concise for a small, unambiguous set.
Resolution
The compiler compares an import path with:
- modules collected from the current source tree;
- module roots contributed by local-path or resolved git dependencies;
- built-in
std/*compatibility imports; - unresolved external paths.
An unknown path under the current project root is an error. An external path whose source has not been loaded produces an external-dependency warning, so a single-package semantic check can continue without pretending the declaration was verified.
Local and dependency modules are registered before import resolution, so mutual imports are allowed:
// orders/order.at
import { Customer } from workreef.dev/seaport/customers
// customers/customer.at
import { Order } from workreef.dev/seaport/ordersThe compiler resolves both modules in the project-wide declaration pass rather than requiring one to be checked first.
Version-string dependencies do not currently supply source because there is no registry resolver. Declaring a constraint alone cannot make such an import fully type-checked.
Prelude names
Core types such as List, Map, Option, and Result are supplied through
the compiler prelude. They do not require:
import { list, map, option, result } from std/collectionsThat lowercase form survives in old documents but does not follow the current naming rules. Import a library module only when the API is not part of the prelude.
Scope
Imports belong to a source file, not an entire directory. A sibling file does not inherit another file’s imports. Same-module public declarations, on the other hand, are injected into each sibling file automatically.
Imports must remain at top level. They do not create a runtime operation, conditional dependency, or mutable namespace object.
Style
Group imports near the beginning of the file. Prefer canonical full module paths over path-shape shortcuts from older documents. Use one alias consistently within a file, and avoid aliases that differ only in capitalization.
An import controls name reachability, not dependency acquisition. Configure
local or git source in atoll.toml; see
Projects.