On the performance of building D programs

Vladimir Panteleev vladimir at thecybershadow.net
Fri Apr 5 06:45:15 PDT 2013


On Friday, 5 April 2013 at 11:29:20 UTC, Andrej Mitrovic wrote:
> On 4/5/13, Vladimir Panteleev <vladimir at thecybershadow.net> 
> wrote:
>> I think -r is redundant, and should be the default action if 
>> only
>> one module is given on DMD's command line. I can't think of
>> plausible situations where this could be a problem.
>
> $ dmd main.d foo.obj
>
> If main has imports to 'foo', how will DMD know whether or not 
> to
> compile foo.d or just link with foo.obj?

-r should be disabled for such cases - thus, enabled only when 
there's one .d file and no .obj / .lib files. Although specifying 
library files on the compiler's command line is a valid use case, 
compatible with recursive compilation, I think we should promote 
the use of pragma(lib) instead.

> You could pass -rxfoo, but you'd still be breaking all existing 
> build
> scripts which rely on non-recursive building.

Yes, the goal is to not affect existing scripts.

>> Considering that you can't have a module with the same name as 
>> a
>> package, the same syntax for excluding both can be used, e.g.
>> "-rxcrc32 -rxstd".
>
> I guess it could work. But I'm hoping one day we'll be able to 
> lift
> that restriction, it's quite a pain in the ass when porting C++ 
> code
> that uses namespaces to D. So for future-compatibility I thought
> separating module and package switches might be nice. It's not 
> a big
> deal though.

Another option is wildcards (std.*).


More information about the Digitalmars-d mailing list