Thread overview
[Issue 8447] New: Self importing is allowed?
Jul 26, 2012
Dmitry Olshansky
Oct 05, 2012
Andrej Mitrovic
Dec 22, 2012
Dmitry Olshansky
July 26, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8447

           Summary: Self importing is allowed?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: dmitry.olsh@gmail.com


--- Comment #0 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-07-26 13:59:15 PDT ---
Program:

module huh;
import huh;

compiles alright.

However the same thing in a bigger project cased spurious forward references around std.conv.text. (Sorry failed to reduce.)

Shouldn't compiler just statically disallow self-importing ?

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


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-04 20:29:10 PDT ---
Phobos has a couple of these self-imports. They all seem to be in unittest blocks, which maybe makes copy-pasting samples to outside modules easier since you automatically get a free import statement included.

Maybe we should allow them in function/unittest scope, and disallow them in module scope. Or should we just ban them outright?

I'm running a test suite on a fix right now.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8447


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


--- Comment #2 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-12-22 13:13:23 PST ---
Going to close it for a moment as the codebase changed radically over time and I'm not 100% sure self-importing was the core cause.

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