Modules
Modules group sets of functions and structures together in a namespace. Each source file is a separate module. Modules must be explicitly declared to be available for use. A module declaration is denoted by the keyword module
followed by the module name.
Modules can only be declared in the source root main.lx
or in a module.lx
file that is placed in a folder. Lexica will look for either a file or folder with the module name from the declaration location.
If both the file and folder exist then both sets of declarations in them will be processed.
Modules may also be declared inline inside a single file. The beginning of the module body is denoted by a colon.
External modules are not allowed to be declared inside a nested module.
Last updated