[Issue 3972] New: Regarding module with name different from its file name

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 15 15:24:01 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3972

           Summary: Regarding module with name different from its file
                    name
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-03-15 15:23:57 PDT ---
Two modules with file names different from the name used in the module
statement:

-------------

// File name: foo.d
module bar;
enum int x = 10;

-------------

// File name: spam.d
module test;
import foo: x;
void main() {}

-------------

When I compile the file spam.d I receive no errors from "spam" being different
fom "test". But I (think I) receive an error for "foo" being different from
"bar":

spam.d(2): Error: module bar is in multiple packages bar

The compiler can try to give a better/more descriptive error message here.


In this situation if you want the compiler can even give two error messages,
complaining that inside the "spam.d" file it has a mismatch module name. If you
want to enforce this too, then I think in Tango there are modules that have a
name with the first letter upper case, but their file name is all lowercase, so
I think the comparison to assert that the module name is the same as the file
name is better done caseless (and because in Windows file names are essentially
caseless).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list