No header files?
Lionello Lunesu
lio at lunesu.remove.com
Sat Oct 24 03:41:03 PDT 2009
On 22-10-2009 8:01, Walter Bright wrote:
> Yigal Chripun wrote:
>> the only valid IMO use case for header files is for linking libs - the
>> compiler can handle just find binary formats for that.
>
> I was originally going to go with a binary format for that - but it
> turned out to be pointless. dmd is so fast at parsing, there simply was
> no advantage to replacing the text file parser with a binary file parser.
>
> If you consider the .di file as a "binary format", I think you'll find
> it fulfills all the purposes of it, as well as being human readable
> without needing a pretty-printer.
There's no need for a new format: D's name mangling has all information
necessary to reconstruct a function's full signature. The only thing
missing is the vtable layout: the order of those functions and any
public/protected data members. Now, if dmd would include some kind of
data in the lib for that, the whole .di could theoretically be
reconstructed from the .lib.
The problem with .di is not so much the extra file, but the added build
complexity: the .di must match the .lib; the compiler must find the .di,
the linker must find the .lib; and what .di goes with what .lib? They
both can have any name, in fact one lib can need any number of .di's.
Also: a .di needs to mention private class members as well, for the
class layout to match. This should not be necessary.
The argument that 'people have been doing it for a long time' is a bad
one. There's a reason you've started D after all, even though people
have been doing things a certain way for a long time.
Perhaps it's my Pascal background, but I miss how I did not have to
worry about include paths and all that then, and I like how I don't have
to worry about it when using C# now.
L.
More information about the Digitalmars-d
mailing list