Compile Imported Modules

Jonathan Marler via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 24 09:32:32 PDT 2017


On Thursday, 24 August 2017 at 15:56:32 UTC, H. S. Teoh wrote:
> On Thu, Aug 24, 2017 at 03:53:05PM +0000, Jonathan Marler via 
> Digitalmars-d wrote:
>> Wanted to get peoples thoughts on this.  The idea is to have a 
>> way to tell the compiler (probably with a command line option) 
>> that you'd like to "compile imported modules".
> [...]
>
> Isn't this what rdmd already does?
>
>
> T

That is one thing that rdmd does (as I mentioned in the original 
post).

I just looked through the rdmd code 
(https://github.com/dlang/tools/blob/master/rdmd.d) and it looks 
like it invokes the compiler using "dmd -v" to get the list of 
modules and then invokes the compiler again with the modules it 
found to perform the full compile.  So my original thought that 
the logic to find modules is duplicated was incorrect.  Instead 
we just pay a performance hit to get the correct list of imports 
since running "dmd -v" seems to take almost as long as the actual 
compile itself.  So this method comes close to doubling the time 
it takes to compile than if the feature was implemented in the 
compiler itself.

In any case, the idea is to allow the compiler to resolve this on 
it's own without help from rdmd.  This would remove the need to 
invoke the compiler twice, once to find the imports and once to 
compile.  It would also allow some projects/applications that 
don't use rdmd to take advantage of this feature, this may or may 
not include dub (not sure on that one).


More information about the Digitalmars-d mailing list