Language Guide / Modules & Imports

Modules & Imports

Organizing multi-file projects with import, pub/private visibility, and dlang.json.

Importing Modules

Use import <name> to load a standard library module or a local .dl file resolved from the entry directory or module_roots.

app.dl
import math
import text
import my_helpers

show math.sqrt(144)
show text.upper("dlang")

Visibility (pub and private)

Prefix declarations with pub or private to control what a module exports to importers.

Project Manifest (dlang.json)

Multi-file projects use dlang.json to declare entry points, module roots, and dependencies:

dlang.json
{
  "name": "my-app",
  "version": "0.1.0",
  "dlang": "0.1.0",
  "entry": "src/main.dl",
  "module_roots": ["src"],
  "dependencies": {}
}