Does D have too many features?

Timon Gehr timon.gehr at gmx.ch
Mon Apr 30 11:09:21 PDT 2012


On 04/30/2012 07:03 AM, Jonathan M Davis wrote:
> On Sunday, April 29, 2012 21:56:08 H. S. Teoh wrote:
>> I wonder if dmd (or rdmd) should have a mode where it *only* compiles
>> unittest code (i.e., no main() -- the resulting exe just runs unittests
>> and nothing else).
>
> It wouldn't make sense. It's nowhere near as bad as C++, but dmd has to
> recompile modules all the time unless you compile the entire program at once.
> When you run a build, every single module on the command line and all of the
> imported modules get compiled.

Only the symbols that need to be analysed actually get analysed (eg. 
CTFE, instantiated templates.) The other symbols are merely parsed, and 
parsing is quite cheap.

> Object code is generated only for those on the
> command line, but the others are still compiled.

I think 'compiled' would imply that some output code is generated.

> Any imported module which
> uses a .di file won't have as much to compile,

There is no difference between .d files and .di files except that the 
compiler prefers the .di file for imports.

> and any templated code that
> doesn't get used in those modules won't get compiled,  but there's still lots
> of recompilation going on if you compile your program incrementally.

It depends on how much CTFE is performed on the module interface level.

> And D

DMD.

> just isn't set up to compile only a portion of a module.
>
> - Jonathan M Davis

If that is necessary then the module is too big.


More information about the Digitalmars-d mailing list