Thread overview
[Issue 16673] improve cyclic module imports checker
Nov 09, 2016
anonymous4
Feb 18, 2017
Martin Nowak
Feb 18, 2017
Martin Nowak
Dec 17, 2022
Iain Buclaw
November 09, 2016
https://issues.dlang.org/show_bug.cgi?id=16673

anonymous4 <dfj1esp02@sneakemail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=16265

--- Comment #1 from anonymous4 <dfj1esp02@sneakemail.com> ---
What about indirect dependencies? Functions in the module can import other modules, they will misbehave if not initialized.

--
November 09, 2016
https://issues.dlang.org/show_bug.cgi?id=16673

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy@yahoo.com

--
November 09, 2016
https://issues.dlang.org/show_bug.cgi?id=16673

--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> ---
I think Martin meant *data* symbols, not functions. Obviously function symbols in local module can depend on external items. Of course, the compiler could extend the check to the local function as well if possible.

I'd go further and say that depending on external compile-time constants can also be allowed (e.g. enums).

--
November 18, 2016
https://issues.dlang.org/show_bug.cgi?id=16673

Steven Schveighoffer <schveiguy@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=16491

--
November 24, 2016
https://issues.dlang.org/show_bug.cgi?id=16673

uplink.coder@googlemail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uplink.coder@googlemail.com

--- Comment #3 from uplink.coder@googlemail.com ---
In this particular case the initialization order is not important, because only
static properties of the imported classes are used.
I will have a look later.

--
November 24, 2016
https://issues.dlang.org/show_bug.cgi?id=16673

--- Comment #4 from uplink.coder@googlemail.com ---
wrong bug Oo.
was supposed to go to
 Issue 16491

--
February 18, 2017
https://issues.dlang.org/show_bug.cgi?id=16673

--- Comment #5 from Martin Nowak <code@dawg.eu> ---
And obviously nested functions within the ctor.
This would turn all ctors in Higgs to standalone ctors. Data initialization is
the biggest use-case for ctors, so this would likely solve many cyclic module
issues.

--
February 18, 2017
https://issues.dlang.org/show_bug.cgi?id=16673

--- Comment #6 from Martin Nowak <code@dawg.eu> ---
Should be fairly easy with the new 2-step lookup process (SearchLocalsOnly,
SearchImportsOnly), just instrument all symbol searches in expression.d to tag
the current scope's func as usesImports, when only the SearchImportsOnly lookup
returns a symbol.
Furthermore CallExp's using such functions also need to tag their scope's
function to make it work transitively.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=16673

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--