.d files without a module statement? Required to be absent?

H. S. Teoh hsteoh at quickfur.ath.cx
Sat Nov 14 19:59:59 UTC 2020


On Sat, Nov 14, 2020 at 05:55:13PM +0000, WhatMeWorry via Digitalmars-d-learn wrote:
> 
> I was poking around the dmd code just to "learn from the best"

IMNSHO, Phobos is more representative of typical D code than dmd; dmd
code was automatically translated from C++, so a lot of it may still
have a lot of C++-isms that wouldn't be in "native" D code.


> and I came across some files that ended with the .d extension which
> did not have the module statement. (I was under the naive impression
> that all .d files must have a module statement)

No, if there is no module declaration, the module name will be inferred
from the filename.


T

-- 
"You know, maybe we don't *need* enemies." "Yeah, best friends are about all I can take." -- Calvin & Hobbes


More information about the Digitalmars-d-learn mailing list