Groups & Modules
Namespacing with groups, importing native and external modules, and how the linker resolves source files.
Groups
group namespaces functions and constants without introducing a new type.
Groups may be nested inside interfaces and modules. A group can also bind to a module namespace, which is how libraries organize Types, Kernels, and Ops:
Modules
A module declaration makes a named module available in the current file. The current spelling for compiler-provided modules is use native:
The older form is still accepted:
Use one form consistently. use native is what the current examples use.
Importing source files
A facade library pulls in its leaf modules in dependency order and ends with deploy:
deploy <module>; publishes the module surface to consumers. dismiss removes a binding from the current scope; it is rarely used in application code.
Importing external libraries
The external path is resolved against vyne/modules/external/. Leaf modules inside a facade are imported relative to that facade. A library may depend on another external library by importing its facade.
Project dependencies declared in project.toml are resolved against the same module roots:
Resolution order
The linker walks the import graph depth-first, resolves each path, and emits modules in topological order. Cycles between source files are detected and reported instead of recursing forever.
| Form | Resolves against |
|---|---|
use native <name> | compiler-provided module registry |
use external "lib/facade.vy" | vyne/modules/external/ |
use "file.vy" | directory of the importing file |
use "dir/file.vy" | relative to the importing file |
Best practices
- Import the facade (
vlin/vlin.vy), not individual leaves, unless you are deliberately trimming the compile unit.vsignal/Spectral.vyis a documented exception: it pulls invfftonly when you ask for it. - Keep
ruleset { dynamic_casting };at the top of facades that use untyped declarations. Application code should prefer explicit types. - Use
groupto keep the public surface tidy; usedeployonly in facades.