Neon code can be divided into modules, which are separate source files.
A module named
example would be found in a file called
Module source code must export identifiers before they can be used outside the module file.
This is done with the
EXPORT hello FUNCTION hello() print("Hello world") END FUNCTION
In order to use an identifier exported by another module, the
IMPORT declaration must be used.
IMPORT os print(os.getenv("PATH"))
Individual identifiers may also be imported:
IMPORT os.getenv print(getenv("PATH"))
When a module is imported, the compiler must be able to locate the code for the imported module. The followed directories are searched in order:
Same directory as the importing source file
The current directory
The directories in the environment variable
The directories listed in the
.neonpathfile in the current directory