www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7730] New: Make imports work case-sensitive on all platforms

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730

           Summary: Make imports work case-sensitive on all platforms
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: armin.kazmi tu-dortmund.de



14:20:36 PDT ---
One of the major issues (or lets say, enerving ones) one has when porting from
e.g. Windows to other platforms is constant mixture of filename/dirname casing
of imports/includes in the sourcecode, which doesn't match the filename case. I
think DMD should enforce that the source path case is consistent with the
module name in order to eliminate such issues.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 18 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
           Severity|normal                      |enhancement


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 18 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc



This is an interesting idea, but I think there are also other alternatives.
Like requiring & enforcing all module names to be fully lower-case.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 18 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730




19:37:40 PDT ---

 This is an interesting idea, but I think there are also other alternatives.
 Like requiring & enforcing all module names to be fully lower-case.
That's also a variant. I actually don't care which one is taken, but I think some enforced standard is really needed here. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 18 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730


Jacob Carlborg <doob me.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doob me.com




 This is an interesting idea, but I think there are also other alternatives.
 Like requiring & enforcing all module names to be fully lower-case.
That would completely break Tango. I don't like the idea. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730




03:41:27 PDT ---


 This is an interesting idea, but I think there are also other alternatives.
 Like requiring & enforcing all module names to be fully lower-case.
That would completely break Tango. I don't like the idea.
I wouldn't really exaggerate that. Actually using a find/sed expression thats quite easy to fix. What I simply want is to have it consistent import/module-lookup behavior across all platforms to save all that mess one already has in C/C++ with it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com



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

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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730




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: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730




05:31:12 PDT ---
Another reason to change that as early as possible, is, a breaking change now
is partially acceptable, but becomes more and more a problem if the language
gets popular and multi-million-loc projects pop up. One could stop that issue
from happening ever again now.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730





 I wouldn't really exaggerate that. Actually using a find/sed expression thats
 quite easy to fix. 
That might be the case but it would still break a lot of code.
 What I simply want is to have it consistent
 import/module-lookup behavior across all platforms to save all that mess one
 already has in C/C++ with it.
I would mind having that either, but I don't want the compiler to force all lowercase. Instead it should force case-sensitive if possible. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 19 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730






 I wouldn't really exaggerate that.  Actually using a find/sed 
 expression thats quite easy to fix.
That might be the case but it would still break a lot of code.
Is there any way we could reasonably deprecate using uppercase letters in module names? (If only we could declare aliases of modules, we could make the old name a deprecated alias for the new one....) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 20 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7730


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au




 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 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.
 
 That said, are there any 32+-bit platforms on which filenames aren't
 case-retentive?
Not according to this: http://en.wikipedia.org/wiki/Filename Moreover, it seems that anything which doesn't retain case, doesn't allow very long filenames. I can't see any reason to require lowercase. It is simple to require that filename case matches module case. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 21 2012