Is the use of .di depreceated ?

Paulo Pinto pjmlp at progtools.org
Mon Apr 23 23:53:32 PDT 2012


On Tuesday, 24 April 2012 at 01:51:54 UTC, Adam Wilson wrote:
> On Wed, 18 Apr 2012 03:02:49 -0700, Robert Clipsham 
> <robert at octarineparrot.com> wrote:
>
>> On 18/04/2012 09:18, "Erèbe" wrote:
>>> Hi,
>>>
>>> I recently discovered that D support file interface .di, but 
>>> through my
>>> past reads I never seen someone using it. The std don't do 
>>> usage of it
>>> (compile time issue maybe ?) and most of D project are in the 
>>> same case.
>>>
>>> Is this feature depreceated ?
>>>
>>> I'm from a C++ background, I agree on the fact that keeping 
>>> declarations
>>> and implementaions sync across two files is tedious, but when 
>>> I have to
>>> read code, I like a clean interface to summarize the thing.
>>>
>>> Dmd doc is there to replace the need of an clean interface ?
>>
>> You can find a list of deprecated features here:
>>
>> http://dlang.org/deprecate
>>
>> .di files are not deprecated, just rarely used. This is for a 
>> few reasons:
>>  * There is no requirement to use them
>>  * They severely limit the capabilities of CTFE 
>> (http://dlang.org/function#interpretation)
>>  * DMD is really fast - the speed gain from using .di files 
>> isn't noticeable for a lot of projects
>>  * If you want them, they're very easy to generate yourself 
>> (use the -Dd and -Df compiler switches)
>>  * For the purposes of reading APIs, DDoc is normally used - 
>> alternatively, all good editors and IDEs provide code folding 
>> to hide implementations
>>
>
> Where DI files come in handy is for commercial libraries that 
> don't want to hand out their source, without DI's that's 
> impossible, therefore for D to be a commercially acceptable 
> language, DI's must work, unfortunately, DI's do not 
> auto-generate to the this requirement right now, I have a patch 
> to fix that. But if you are OSS, you don't really care, just 
> deliver the source as the "library".

D could see use an approach similar to what Delphi does, where 
the tooling is able to extract the information from the .tpu 
files (delphi libraries), as far as I can remember. Go has a 
similar approach where the package information is stored in a 
special section in the library/object files.

But I guess di files are anyway easier to maintain.


More information about the Digitalmars-d mailing list