Name of files causes error. Why?

Steven Schveighoffer schveiguy at yahoo.com
Wed Apr 11 12:50:19 PDT 2012


On Wed, 11 Apr 2012 15:33:56 -0400, Xan <xancorreu at gmail.com> 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.

All d module files (i.e. d source files) must be a valid identifier.

See this document for what an identifier can contain:  
http://dlang.org/lex.html#Identifier

Now, you *can* possibly name the module differently using a module  
statement, but this is highly discouraged.  If you do this, the only way  
another module can import your differently-named module is if you pass the  
file on the command line.

-Steve


More information about the Digitalmars-d-learn mailing list