On Sat, 04 Nov 2017 09:51:12 +0000, codephantom wrote: >> It might also make sense, that if a source code file does not contain a >> module statement, then it should not be treated as a module, and the >> compiler should look to the import statements instead of implicitly >> making in a module. >> > > I should add one more thing. > > Both Andrei's book (The D Programming Language), and Ali's book > (Programming in D), provide the usual 'hello world' thing, at the > beginning. In both cases, the 'module' statement is not part of that > example. That is consistent with other 'hello world' I've seen in D. All > the other code in both book also consistently leaves out the 'module' > statement. > > My point being, given that "D is serious about modularity" (as Andrei > put it in his book), then I think all 'hello world' examples should > include the 'module' specifier as well, and explain why it's there too. > I think that would really aid those who are new to the language..
Many people seem to leave the module statement out of their main.d/app.d files; I think it's a way to say "this is the main thing - don't import it from somewhere else." Basically, it's easier to act like that code isn't in a module than it is to have the compiler support code not in a module.
