Use the use keyword to import a dryLang module:
This loads helpers.y from the same directory.
| Statement | File Loaded |
|---|---|
use "helpers" | ./helpers.y |
use "utils/math" | ./utils/math.y |
use "lib/string" | ./lib/string.y |
The .y extension is added automatically.
By default, all top-level variables and functions in a module are exported (accessible to importers).
Use pv to mark items as private:
You can run multiple files together:
Or run all .y files in a directory:
Files are concatenated in order, so declarations in earlier files are available in later files.
You can import scripts directly from the internet by providing a full URL:
The compiler fetches the file, parses its AST, and prepends its statements into your program.
dryLang natively supports importing scripts directly from GitHub repositories:
The compiler automatically translates this to:
https://raw.githubusercontent.com/user/repo/main/idx.y
It looks for idx.y as the default entry point of the remote module.
You can also specify a path within the repo:
If two modules import the same file, dryLang only loads it once. The resolved path is cached globally across the entire compilation.