I'm designing a simple OO programming language.
It's statically typed, compiled, and executed by a VM - similar to Java.
The difference is that I don't want to have such a strong emphasis on OOP. The code itself will mostly resemble C++ (classes, functions, and variables allowed in the file scope).
One of the things that I need to have is a module system. I have the following figured out:
- Every file is a module (once compiled) - like Python
- Programmers must import a module with the
importkeyword, which causes the compiler to search for modules in standard directories and the file directory (the VM has to do this at runtime as well)
And now I have no idea how should I introduce the concept of submodules and module hierarchy.
One option, for example, is to depend on the directory hierarchy, so that
import engine.graphics.renderer would expect to find a directory called "engine" in the working directory, and inside a directory called "graphics", with a module called "renderer".
What are the drawbacks of such a design? Am I missing anything?