proposal: private module-level import for faster compilation

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 21 23:38:25 PDT 2016


On 2016-07-21 10:52, Kagamin wrote:

> As I see dependency resolution has function granularity, but headers
> have only file granularity. How do you expect headers to work on finer
> granularity level? If a module depends on another module, the header
> must assume it depends on all members of that module and if one member
> indirectly changes due to its private dependencies, it must be assumed
> that all depending modules must be recompiled, because they depend on
> the changed module even if they don't depend on the changed member and
> its private dependencies.
>
> Not sure if tup can solve this problem. It can if it builds full
> dependency graph for each file instead of having one graph for the whole
> project.

A guess:

module a;

import b;

void foo()
{
     Bar bar;
}

module b;

struct Bar {}

The .di/header for module "a" don't need to include "import b" because 
"Bar" is not part of the interface of module "a".

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list