extern (D)?

Rob T alanb at ucora.com
Fri Jan 18 00:09:15 PST 2013


On Friday, 18 January 2013 at 07:34:35 UTC, Jacob Carlborg wrote:
>
> You cannot both have CTFE/inlining/templates and hide the 
> source code. It's the same as in C++.

Yes I am aware of that limitation, nothing can be done except 
lose the flexibility of templates and so forth, or keep it and 
expose the source code.

>> For classes and structs, I have no idea how to leave out the
>> implementation details.
>
> You can either use an interface or just not provide an 
> implementation for the methods. Note that it's perfectly fine 
> to have a method in D without an implementation even it's not 
> abstract. This is to support the use case you have here and 
> separate compilation.

I figure that's the best approach, but I am not sure how to not 
supply the implementation for a module, since in D there doesn't 
seem to be a separation of interface and implementation.

> I guess you would need to list the fields on classes/structs, 
> again that's just like C++.

I have not yet seen examples or documentation explaining how to 
separate interface and implementation from a class or struct. Are 
you sure this can be done?

--rt


More information about the Digitalmars-d-learn mailing list