extern (D)?

Jacob Carlborg doob at me.com
Thu Jan 17 23:34:35 PST 2013


On 2013-01-18 05:37, Rob T wrote:

> The documentation says that the interface files will only contain the
> parts of a module's source code that is required for linking, however I
> read somewhere that it pretty much does nothing but strip out the
> comments because it needs the full source code for a inlining, CTFE, and
> templates. So I'd have to manually modify or construct them manually,
> which means I'll lose some abilities, but that may be OK for some
> situations.

You cannot both have CTFE/inlining/templates and hide the source code. 
It's the same as in C++.

> 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 guess you would need to list the fields on classes/structs, again 
that's just like C++.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list