Bug 7651 – Cannot use object.d file in user projects
Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-05T10:03:00Z
Last change time
2012-03-05T11:13:36Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2012-03-05T10:03:20Z
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.
Comment #1 by bugzilla — 2012-03-05T11:13:36Z
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.)