Modules

Each .mox file is a module.

Importing

import "std.mox";
import "./my_module.mox";

Modules can import each other in a circle. This is allowed.

Named imports

Give a module a name to keep its names apart:

const raylib_link := import "vendor/raylib/link.mox";

raylib_link.link_raylib(true);

What is visible

Names from an imported module are visible only in the file that imports it. If a.mox imports b.mox, and main.mox imports a.mox, then main.mox does not see b.mox.

To make a “root” module that gives all names from its parts, add #export:

// all.mox
import "./part1.mox" #export;
import "./part2.mox" #export;

Now import "./all.mox"; gives you the names from both parts.

This is how std.mox works: one import gives you the whole standard library.

Built-in modules

Some useful modules in the modules folder: