On Tuesday, 25 September 2012 at 17:54:39 UTC, Jonathan M Davis wrote:
On Tuesday, September 25, 2012 13:58:00 Daniel Kozak wrote:
Yes, it works. Thanks a lot.

However I still dont get it, why dmd generates all sources
instead of just public symbols and functions declarations

A number of features do not work if not all of the source is available. In particular, functions can't be inlined if the compiler doesn't have their source, and any function which is used at compile time (using CTFE - compile time function evaluation) needs its full source and the source of every function that it calls. So, in general, it's pretty crippling to not have the full source available. Also, templates tend to be used quite heavily in D, and because templates aren't actually instantiated until they're used, their entire source must be in the .di file regardless, making it so that you _can't_ hide their code (C++ has exactly the same issue). So, in general, .di files
don't make a lot of sense.

But if all that anyone is doing is calling the functions at runtime, and it doesn't matter that they're not inlinable, and you don't need any of them to be templated (or it's okay for the few that are templated to have their full source in the .di file), then you can strip out the function bodies in .di files, and that _can_ be useful if you really need that, but pretty much no one's going to do that unless they have to (or just don't understand what they
lose by doing so).

- Jonathan M Davis


Thanks for explanation.

Reply via email to