Why should file names intended for executables be valid identifiers?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 14 20:08:36 PST 2015

On Tuesday, 15 December 2015 at 03:31:18 UTC, Shriramana Sharma 
> I understand that module names need to be valid identifiers in 
> that other modules would need to import them. But when a file 
> is intended to be just an executable, why is it mandatory to 
> give it a module declaration with a valid identifier?

It still has a module name that can be used in reflection, must 
be used in name disambiguation (at the linker level if nothing 
else, any functions are mangled with the module name so they 
don't conflict with C functions with the same name), and other 

Just use the module declaration, you can always call it something 
like `module main;` generically if you know there is just one in 
your file.

More information about the Digitalmars-d-learn mailing list