Includes

There are three ways for code to refer to other code:

  1. A relative file include INCLUDE "../some/file": this makes all code inside another file visible to the current file.

  2. A global file search INCLUDE 'some-project/file': this tries to find the path in any of the include directories passed to the compiler. This should be used to include code that is neither part of a dependency project nor of the current project, such as system-specific libraries or settings.

  3. Including code from a module from a dependency project: this looks through the dependency projects and includes code from there. There are multiple syntaxes for importing from other modules:

    • INCLUDE project::path::to::code makes visible path::to::code from the other project as code,

    • INCLUDE alias := project::path::to::code makes it visible as alias,

    • INCLUDE project exposes the whole dependency project in a namespace of the same name.

    • INCLUDE namespace := project exposes the whole dependency project as the given namespace name.

    Anything imported this way cannot be overloaded or extended, and nothing must exist under the name under which it is imported. Thus, anything accessed through an imported name can only be found inside the given project, making code easier to read and reason about, as well as easier to compile.

Projects

A project is defined by a project configuration and a collection of source files. When a project is imported from another project, the merged scope of all of that project's source files is exported.