On Saturday, 4 November 2017 at 09:34:05 UTC, codephantom wrote:
Yes. All that makes complete sense I guess.

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.

btw. That bug in gdc, which appear to do just that, is a nice bug ;-)

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..

Reply via email to