Why?

Hipreme msnmancini at hotmail.com
Thu Apr 4 15:36:31 UTC 2024


On Thursday, 4 April 2024 at 14:11:35 UTC, Paolo Invernizzi wrote:
> On Thursday, 4 April 2024 at 13:15:50 UTC, Hipreme wrote:
>> On Thursday, 4 April 2024 at 12:27:00 UTC, Paolo Invernizzi 
>> wrote:
>>> On Thursday, 4 April 2024 at 11:10:04 UTC, Richard (Rikki) 
>>> Andrew Cattermole wrote:
>>>>
>>>> On 05/04/2024 12:07 AM, Paolo Invernizzi wrote:
>>>>> [...]
>>>>
>>>> No I meant shared libraries.
>>>>
>>>> Specifically the distribution of the source files that act 
>>>> as the interface to it.
>>>>
>>>> That way you have the .sar file and the .dll and that's 
>>>> everything you need to use it.
>>>
>>> Aren't 'di' sources the target solution for library API? 
>>> What's the problem in distributing a zip or tar?
>>>
>>> In C++ you usually have a specific "include" directory with 
>>> all you need, what's the burden in doing a zip with the 
>>> shared library binary and the 'di' directories?
>>>
>>> /P
>>
>> The .di feature is a big flop of D. They are nearly useless, 
>> their generation is dumb since no code analysis is done for 
>> removing useless imports. It should analyze the code and: 
>> check if the type import is used or not. Also, public imports 
>> are always kept.
>> There's no reason nowadays to use auto DI generation. One must 
>> either completely ignore this feature or just create their own 
>> DI files.
>
> Let's put aside the implementation of the automatic way to 
> generate '.di', and rephrase:
> Are .di intended to be the correct way to expose _public_ API 
> of an opaque library binary?
>
> What's the problem SAR targets to solve that a package manager 
> can't solve? Why D needs it?


On the case of it being opaque, I could not care less. Yes, .di 
files are the correct way to expose public API. When they are 
used correctly, you could reduce by a lot the compilation time 
required by your files.

SAR solves exactly 0 things. It wasn't even put to test and 
Dennis even tested in the thread discussion SAR vs dmd -i. DMD -i 
was faster. Walter said that a cold run could be way faster 
though since the files won't need to be mem mapped.


More information about the Digitalmars-d mailing list