Name of files causes error. Why?

Jesse Phillips jessekphillips+D at gmail.com
Thu Apr 12 21:16:51 PDT 2012


On Wednesday, 11 April 2012 at 19:33:58 UTC, Xan wrote:
> Hi,
>
> With helloworld program named with score or underscore, I 
> receive the following __annoying__ error:
>
> $ gdmd-4.6 hola-temp.d
> hola-temp.d: Error: module hola-temp has non-identifier 
> characters in filename, use module declaration instead
>
> Why?
> Can someone fix it. It's really annoying
>
> Thanks in advance,
> Xan.

Module names are used for import statements:

import mymodule;

As this is D code, it must have a valid identifier so that it
parses

import my-module;

This could probably be special cased, but you can use these names
in code

auto a = my-module.foo();

Are you subtracting 'my' from 'module.foo()?'

You can name you files whatever you want. Just include your
module name at the top (recommended anyway)

module my_module;

In this case, if you module file is named my-module, then rdmd
and other build tools that use your import information will be
unable to locate my_module.d because that file does not exist.


More information about the Digitalmars-d-learn mailing list