On 3/25/2011 4:10 AM, Vladimir Panteleev wrote:
On Fri, 25 Mar 2011 13:05:39 +0200, Russel Winder <[email protected]> wrote:

It appears that DMD barfs on files with - in the file name. Why?

Do you mean, why doesn't DMD try to work around the problem automatically (e.g.
by substituting/removing invalid characters in the module identifier)? The error
message answers your verbatim question.

"test-file-name.d: Error: module test-file-name has non-identifier characters in
filename, use module declaration instead"


The compiler synthesizes the module name from the file name. If the file name has non-valid module identifiery characters in it, it can't do that. Hence the error message. The solution is to either use a module declaration to set the module name, or rename the file to be a valid module identifier.

The filename=modulename and directory=packagename equivalence allows for the compiler to simply find and load imported modules. Without it you'd need some complex database to map the module names to files.

Reply via email to