Packages
A package is Jiang’s project boundary. A directory with package.ini can be compiled from its
package root, and the compiler follows the reachable source dependency closure.
Package Manifest
Section titled “Package Manifest”Use a fixed package.ini file:
[package]name = approot = src/main.jiangFields:
name: package name; defaults to the directory name.root: entry source file; defaults to<name>.jiang.
When the compiler input is a directory, it reads package.ini and compiles the source file named by
root.
Dependencies
Section titled “Dependencies”Declare local source dependencies in [dependencies]:
[package]name = approot = src/main.jiang
[dependencies]util = ../utilInside the package, import a dependency by alias:
import util;
Int main() { return util.answer();}An unquoted import util; first checks the current package’s [dependencies] table. If it matches,
the compiler reads the dependency package manifest and adds its root module to the same compile
closure.
Public Surface
Section titled “Public Surface”Cross-package access only sees the dependency package root module’s public namespace:
publicdeclarations in the root file are package API.public importin the root file re-exports a module namespace.public aliasin the root file re-exports a concrete public symbol, such aspublic alias answer = util.answer;.publicdeclarations in non-root files are not automatically package API.
This makes the root file the explicit API boundary of a package.
Import Boundaries
Section titled “Import Boundaries”Do not use a quoted path to import dependency source across package boundaries:
import "../util/src/util.jiang"; // error: cross-package file importDeclare the dependency in package.ini, then write:
import util;Package dependency cycles are rejected. Module import cycles are currently allowed.
Entry Function
Section titled “Entry Function”Only the root package root module contributes the executable entry. A dependency package may define a
function named main, but it is treated as an ordinary function.