www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9881] New: Indirect cyclic imports are not forbidden

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

           Summary: Indirect cyclic imports are not forbidden
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody puremagic.com
        ReportedBy: thecybershadow gmail.com


--- Comment #0 from Vladimir Panteleev <thecybershadow gmail.com> 2013-04-05
13:40:00 EEST ---
Consider a program with three files:
=== A.d ===
import B, C;
void main() {}
=== B.d ===
import A;
shared static this() {}
=== C.d ===
import A;
shared static this() {}

Illustrated:

+---+      +---+      +---+
|   | ---> |   | ---> |   |
| B |      | A |      | C |
|   | <--- |   | <--- |   |
+---+      +---+      +---+

B and C have static constructors.

This program is allowed to compile and run, even though there is a circular
dependency between B and C. In a practical case, it can result in a problem
when B accesses something initialized in C via something in A.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9881


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code dawg.eu


--- Comment #1 from Vladimir Panteleev <thecybershadow gmail.com> 2013-04-05
13:57:40 EEST ---
CCing Martin Nowak, author of the current iteration of cycle detection code:
https://github.com/D-Programming-Language/druntime/commit/e07f159a98b51a22f4a1b4484119f1b4fc7e5b26

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 05 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9881


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|nobody puremagic.com        |code dawg.eu


--- Comment #2 from Martin Nowak <code dawg.eu> 2013-10-01 13:32:53 PDT ---
Didn't saw the CC, I'll have a look.

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