Relative module loading
It could be very useful to allow loading modules relative to the main numbat program that has been run. This would allow to easily distribute code to multiple files and create 'projects' without adding the directories to the NUMBAT_MODULES_PATH environment variable.
For example, consider following directory structure:
└── project
├── main.nbt
├── A.nbt
└── subproject
└── B.nbt
When running numbat main.nbt, use A or use subproject::b should be valid use statements.
Of course this feature would require to figure out a way to handle name clashes which might makes the loading system a bit more complicated.
Thank you for reporting this.
I agree, this would be nice to have. Basically a kind of "package" structure on top of the existing "module" structure. When I hear "relative imports", I'm immediately reminded of Python and the various problems with its module/package structure. So I think this is something that should be planned carefully.
For example, it feels like Rust has put a lot of thought into this. For example, I think the name-clash problem is resolved by prepending paths with crate::… to refer to the current "package" or self::… to refer to the current module. It might be worth doing a bit of research into other languages as well.