Files
c2/specs/IMPORTS.md
2026-04-25 15:28:33 +02:00

539 B

Imports

The import statement allows one module access to the public declarations of another module.

Syntax

The import statement uses the following syntax:

import module_name;

They can optionally be prefixed by the public keyword, in which case the module will export everything in the import transitively.

For instance,

--- a.c2
module a;
import b;

--- b.c2
module b;
public import c;

--- c.c2
module c;

// Some declarations

In this example, both module a and b can access the declarations in module c.