Proposed improvements to the separate compilation model

Rob T alanb at ucora.com
Tue Mar 5 17:13:31 PST 2013


On Tuesday, 5 March 2013 at 20:51:02 UTC, Dicebot wrote:
> As far as I get spirit of this proposal, compiler should do the 
> very same checks and complain on mismatch between interface and 
> implementation. Because it knows it is his interface, contrary 
> to C. And there is no sane way to avoid it in the same sense as 
> with inheritance - if you want to keep sync between entities in 
> two places, some duplication is inevitable. And that is 
> acceptable if it is minimal and not error-prone (== verified by 
> compiler).

Yes complier verification has to be done between interface and 
the implementation. The ,di file however should be auto generated 
and not considered a part of the source code. The only 
verification I could think of for a .di file, is to make sure 
that the ,di is not overwritten if there's no change to the 
interface so as to prevent triggering unnecessary rebuilds. Such 
a thing would be useful for large projects.

>> You'll need to explain more what you are trying to accomplish 
>> because I sincerely cannot understand what you are arguing 
>> for. Why would anyone ever want to start off with a .di 
>> interface?
>
>> ...
>
> Ye, probably this is the root cause of disagreement. My use 
> case is not closed-source distribution, it is more of design 
> philosophy/approach for large projects.
[snip]

Perhaps the idea of allowing separate interfaces for modules is 
what you are asking for. I don't oppose adding better interface 
abilities to D, and from the discussion in here I think valid 
arguments were made in favor of that. For your use case, you 
should get what you want if real interfaces were added to D, so 
if you are to make a case to meet your specific needs, then 
please push for adding better interfaces to D, rather than 
support suggestions that we can solve interface problems through 
direct manual maintenance of .di files.

--rt


More information about the Digitalmars-d mailing list