Re: Why should file names intended for executables be valid identifiers?

2015-12-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 17 December 2015 at 04:26:04 UTC, Shriramana Sharma wrote: Sorry but I don't get this fully: can't a hyphen be part of such mangled names? I'm actually not sure but I have never seen it done. And any reflection of the module name would also be just a string which need not be a

Re: Why should file names intended for executables be valid identifiers?

2015-12-17 Thread Alex Parrill via Digitalmars-d-learn
On Tuesday, 15 December 2015 at 03:31:18 UTC, Shriramana Sharma wrote: I expect it should not be difficult for the compiler to see that this D file is not a module being imported by anything else or even being compiled to a library which would need to be later imported. In which case, why does

Re: Why should file names intended for executables be valid identifiers?

2015-12-17 Thread Ali Çehreli via Digitalmars-d-learn
On 12/16/2015 08:26 PM, Shriramana Sharma wrote: > can't a hyphen be part of such mangled names? Perhaps my response is naive but hyphen means subtraction (or minus). If the grammar is context-free then it cannot appear in a name, no? Ali

Re: Why should file names intended for executables be valid identifiers?

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
Adam D. Ruppe wrote: > 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 > things. Sorry

Re: Why should file names intended for executables be valid identifiers?

2015-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-12-17 05:26, Shriramana Sharma wrote: Sorry but I don't get this fully: can't a hyphen be part of such mangled names? Aren't they just strings that the linker hashes or something? (My knowledge of compiler/executable internals is limited.) I'm not sure about a hyphen but a dollar sign

Re: Why should file names intended for executables be valid identifiers?

2015-12-14 Thread Jon D via Digitalmars-d-learn
On Tuesday, 15 December 2015 at 03:31:18 UTC, Shriramana Sharma wrote: For instance, hyphens are often used as part of executable names on Linux, but if I do this: $ dmd usage-printer.d I get the following error: usage-printer.d: Error: module usage-printer has non-identifier characters

Re: Why should file names intended for executables be valid identifiers?

2015-12-14 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 15 December 2015 at 03:31:18 UTC, Shriramana Sharma wrote: 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

Why should file names intended for executables be valid identifiers?

2015-12-14 Thread Shriramana Sharma via Digitalmars-d-learn
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? For instance, hyphens are often used as part of