On Saturday, 8 December 2018 at 03:30:30 UTC, Jonathan M Davis
wrote:
There's one main per program, not per module. Where main lives
depends on how the program was written, but dub encourages
putting it in app.d, because that's what it generates when you
create a new dub project. imports then provide access to other
modules so that the code doing the importing can use it. You
can think of it like the module with main being the start of
the import tree, though it's a bit more complicated than that
in practice, since modules can be compiled separately, and main
only has to be there when the program is finally linked. But in
concept, you have main and the module its in importing other
modules, which then import other modules, etc. until you get
all of the code in the program.
- Jonathan M Davis
Thanks for all of the great feedback and explanations, Jonathan!
Looks like I need to add dub to the list of things I still need
to learn about.