digitalmars.D - Partially qualified module name lookup
- Peter Alexander (12/12) Feb 15 2011 If I have two functions within nested modules:
- Andrej Mitrovic (15/15) Feb 15 2011 If modules B and C belong to the A package, then there are no "B" and
If I have two functions within nested modules: A.B.foo() A.C.foo() Why can't I refer to them using B.foo(); C.foo(); ?? DMD just complains about undefined identifiers B and C. The only way to refer to those is to fully qualify them: A.B.foo(); A.C.foo(); Is this a bug?
Feb 15 2011
If modules B and C belong to the A package, then there are no "B" and "C" modules, there are "A.B" and "A.C" modules. You can refer to a foo function by either: foo() or A.b.foo() Of course, in this case the two functions will conflict if you don't fully qualify the names. A workaround is to use named imports: import B = A.B; import C = A.C; void main() { B.foo(); C.foo(); }
Feb 15 2011