www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7651] New: Cannot use object.d file in user projects

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

           Summary: Cannot use object.d file in user projects
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



10:03:20 PST ---
File structures:
foo\object.d:
module foo.object;

foo\main.d:
module foo.main;
import foo.object;
void main() {}

$ dmd -I.. main.d object.d 
object.d: Error: module foo.object from file object.d conflicts with
another module object from file object.d

The issue is that druntime\import\object.di has this module declaration:
module object;

IOW, 'object.d' does not belong to a package and DMD simply refuses to compile
two modules together when one has a package name and the other has not.

Now I've never seen people use 'import object;' in D code before, so why not
move object.d into the core package instead of making it a packageless module?
I know it's "special", but "object" is a very common name and it will probably
conflict with other people's projects if they try to use a 'object.d' module of
some custom package in their code.

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |WONTFIX
           Severity|normal                      |enhancement



11:13:36 PST ---
object.d is special, and users cannot name any of their imports object.d even
if they put it in a package.

I don't see its current location as being a problem, and the disruption of
moving it into a package doesn't accomplish anything. (It's location is
hardwired into the compiler, name mangling, etc.)

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