[Issue 7730] Make imports work case-sensitive on all platforms

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 19 05:28:14 PDT 2012


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



--- Comment #6 from Armin Kazmi <armin.kazmi at tu-dortmund.de> 2012-03-19 05:28:29 PDT ---
> The problem at the moment is that the capitalisation of a module's name, in the
> absence of a module declaration, depends on the name by which it is referenced.
>  Try this at home:
> 
> ----- modulecap_a.d -----
> import modulecap_b;
> ----- ModuleCap_b.d -----
> int x = .y;
> ----------
> C:\Users\Stewart\Documents\Programming\D\Tests>dmd modulecap_b.d
> modulecap_b.d(1): Error: undefined identifier module modulecap_b.y
> 
> C:\Users\Stewart\Documents\Programming\D\Tests>dmd ModuleCap_b.d
> ModuleCap_b.d(1): Error: undefined identifier module ModuleCap_b.y
> 
> C:\Users\Stewart\Documents\Programming\D\Tests>dmd modulecap_a.d
> modulecap_b.d(1): Error: undefined identifier module modulecap_b.y
> ----------
I'm not really that much into the internals of dmd, but in the given case, 
dmd could fail to import "ModuleCap_b" by simply comparing it with the import
case "modulecap_b" and also output a warning that one should check the case.

Also, for the same reason, all arguments passed into dmd which refer to files,
should also work case-sensitive (just to make it easier to have makefiles,
buildscripts work correctly across platforms). 
> 
> I can imagine this leading to havoc if the same module is referenced from
> different modules by different capitalisations of the name.
> 
> If there's a module declaration, go with that.  Otherwise, go with the actual
> capitalisation of the filename, thereby ensuring platform-consistent behaviour.
I know how to "prevent" that issue. You're pretty much forced to prevent it
when using linux. But seeing a lot of C/C++ code in windows, windows developers
simply ignore the problem altogether. Also, I think, that such trivial code
should really work exactly in the same way to the file level across all
platforms. It's not hard to implement it and would completely eliminate such
issues before they start becoming popular. I really wondered why that wasn't a
design decision from day one.

(BTW: similar arguments are valid for int vs size_t)

> 
> That said, are there any 32+-bit platforms on which filenames aren't
> case-retentive?
I don't know

-- 
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