Organizing Code
This part covers how code is organized and shared: modules, packages, imports, and visibility.
Modulemodule is the file-level organizational unit and visibility boundary. Each file carries at most one module declaration, and it must come first in the file. A file without a declaration falls into the default module Main (implicitly partial).
PackageA package is the unit of compilation, publishing, and dependencies.
Importimport decides how external names enter the file: some bring a prefix, some bring short names, and some only activate extension methods. Each of the nine forms has its own job.
VisibilityVisibility modifiers come in two domains: the top-level domain governs top-level declarations in a module, and the member domain governs type members.
Last updated on October 11, 2026
