From a84bce37f15f8fc6f7d2e490725b5f539f27300c Mon Sep 17 00:00:00 2001 From: Pierre Curto Date: Thu, 25 Jan 2024 21:50:42 +0100 Subject: [PATCH] docs: add a section about modules specifics (#20653) --- doc/docs.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/docs.md b/doc/docs.md index 5077446d068550..07c75600088cef 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -3266,6 +3266,19 @@ fn main() { * You can create modules anywhere. * All modules are compiled statically into a single executable. +### Special considerations + +For the top level project folder (the one that is compiled with v .), and *only* +that folder, you can have several .v files, that may be mentioning different modules +with `module main`, `module abc` etc + +This is to ease the prototyping workflow in that folder: +- you can start developing some new project with a single .v file +- split functionality as necessary to different .v files in the same folder +- when that makes logical sense to be further organised, put them into their own directory module. + +Note that in ordinary modules, all .v files must start with `module name_of_folder`. + ### `init` functions If you want a module to automatically call some setup/initialization code when it is imported,