[D-runtime] Why does druntime us .di files instead of .d?

Steve Schveighoffer schveiguy at yahoo.com
Thu Jul 14 04:01:07 PDT 2011

Right.  I would think the most important reason to use .di files is to hide private imports.  The GC is a good example, you don't want to import the GC implementation when importing core.memory.  But in fact, core.memory doesn't import anything from rt, it links to the GC implementation via extern(C) functions, so the implementation of core.memory is not a good example.

I think to a point, using .di files has merit.  To be certain, anything that imports anything from rt should be hidden (I'm not sure if there are any cases of that).  But we should consider the cost of disabling CTFE on druntime functions, especially those in core that really aren't managing the actual runtime of the compiler, but are just tools used by both druntime and phobos (core.time and core.math come to mind).


>From: Walter Bright <walter at digitalmars.com>
>To: d-runtime at puremagic.com
>Sent: Wednesday, July 13, 2011 6:41 PM
>Subject: Re: [D-runtime] Why does druntime us .di files instead of .d?
>On 7/13/2011 3:19 PM, Jonathan M Davis wrote:
>> Given its heavy use of templates, I'm not sure how much that'll buy us in
>> terms of compilation speed, and since it's all open source, I don't know why
>> it would matter about hiding implementation details.
>Consider the garbage collector. Should every compilation have to recompile that, 
>D-runtime mailing list
>D-runtime at puremagic.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d-runtime/attachments/20110714/911bdbaa/attachment.html>

More information about the D-runtime mailing list