digitalmars.D.bugs - [Issue 3972] New: Regarding module with name different from its file name
- d-bugmail puremagic.com (42/42) Mar 15 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3972
- d-bugmail puremagic.com (31/31) Mar 16 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3972
- d-bugmail puremagic.com (11/11) Mar 17 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3972
- d-bugmail puremagic.com (10/10) Mar 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3972
- d-bugmail puremagic.com (10/10) Mar 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3972
- d-bugmail puremagic.com (14/14) Apr 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3972
- d-bugmail puremagic.com (10/10) Apr 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3972
- d-bugmail puremagic.com (14/14) Dec 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=3972
- d-bugmail puremagic.com (7/7) Dec 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=3972
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 puremagic.com ReportedBy: bearophile_hugs eml.cc 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: -------
Mar 15 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3972 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |clugdbug yahoo.com.au I actually hit this today and got sufficiently irritated to improve the error message a bit. The 'else' clause should also be improved, it's bug 2059 ("Horrible error message"). Perhaps change it to (untested): error(loc, "has inconsistent naming. It was imported as %s", srcname); Index: module.c =================================================================== --- module.c (revision 416) +++ module.c (working copy) -621,7 +621,10 if (!dst->insert(this)) { if (md) - error(loc, "is in multiple packages %s", md->toChars()); + { + error(loc, "has inconsistent naming.\n" + "It was imported as %s but module declaration is %s", srcname, md->toChars()); + } else error(loc, "is in multiple defined"); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 16 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3972 Thank you. Can the compiler complain in the other situation too? (I mean when no imports are present, and your program is a file named "foo.d" with written "module bar;" at the top? If the mismatch name is an error when you import the module, then I think it has to be an error in this case too. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 17 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3972 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com 17:48:31 PDT --- changeset 427 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 28 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3972 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason.james.house gmail.com 17:49:55 PDT --- *** Issue 2059 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 28 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3972 In dmd 2.043 now compiling spam.d generates the error: spam.d(3): Error: module bar from file foo.d conflicts with another module bar from file foo.d That's not a a good error message, I am not able to understand it. A better error message is like the following pair: spam.d(2): Error: module 'test' has mismatched file name 'spam.d'. foo.d(2): Error: module 'bar' has mismatched file name 'foo.d'. Note that they are two errors, because both modules have a wrong/mismatched name. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 09 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3972 After a short discussion with Walter it seems that in D it's OK to have a file named "foo.d" with inside it at the top written "module bar;". The rationale behind it is "The flexibility comes in handy now and then.". So probably there's no interest in fixing this small umpteenth hole in the module system. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 09 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3972 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |andrej.mitrovich gmail.com Resolution| |DUPLICATE 15:19:33 PST --- pull for 4479 will fix this, with the new message being: spam.d(2): Error: module bar from file foo.d must be imported as module 'bar' *** This issue has been marked as a duplicate of issue 4479 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 20 2012
http://d.puremagic.com/issues/show_bug.cgi?id=3972 Some discussions here: http://forum.dlang.org/thread/iakfgxjlfzrbxerxpria forum.dlang.org -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 20 2012