No header files?

AJ aj at nospam.net
Wed Oct 21 18:05:46 PDT 2009


"BCS" <none at anon.com> wrote in message 
news:a6268ffbb078cc2081280f1286 at news.digitalmars.com...
> Hello aJ,
>
>> "BCS" <none at anon.com> wrote in message
>> news:a6268ffbae78cc207990f9b394 at news.digitalmars.com...
>>
>>> I'm not sure what use you are seeing for them.
>>>
>> The 2 that I gave were:
>>
>> 1. Serves as a "blueprint" (or skeleton) for further development.
>
> .d files can do this
>
>> 2. Serves as "documentation" for usage or for
>> evaluation-for-purpose
>> (suitability).
>
> I will hold that the full source or "webpage like" documentation will do 
> better in all cases than a header file. The first for where the details 
> matter and the second for all other cases because it can contain anything 
> the header can and is not bound by language constraints.

We'll  have to agree to disagree on that. Eliminating headers but requiring 
a "webpage", is "robbing Peter to pay Paul".

>
>> (1) is "working at a higher level (designing vs. implenting) and
>> perhaps even separating much of the design work from the
>> implementation work (i.e., separate individuals or teams working on
>> one or the other). (2) eliminates the need for secondary documentation
>> (for well-designed code). I think of secondary documentation as the
>> detailed description of how something works. Prior to consulting such,
>> I'd want to know "what" something is, and something like a class
>> declaration gives me that information immediately, without reading
>> paragraphs of text. For example, you can describe "car" to me, but it
>> would be much easier to just show me one.
>>
>
> As said above, you can declare a class without implementing it in the 
> current system as well as progamaticly extract what you are asking for in 
> whatever format you want.

So, it would appear, that if I am to write in D, I will be writing .di files 
just like I write .h files in C/C++. OK.

>
>>> As far as documentation goes, In the cases where I don't care about
>>> the implementation, I'd rather see some kind of extracted, generated
>>> documentation rather than a header file.
>>>
>> Class Shape
>> {
>> void Draw();
>> }
>> What more do you need to know usually?
>>
>
> Some times I'd like some comments/verbiage.

Well of course header files will have comments. The thing is though, tomes 
of documentation are not necessary you have header files. And what are the 
chances that the documentation will be in synch with the code if the 
documentation is external? Much better chance of that if the header file IS 
the documentation and the code is crafted such that it needs very little 
doc.

> Some times I'd like exactly that but with better formatting.

Seems like the exception rather than the common case. It depends on the 
coding style I guess. Certainly the STL header files are useless as any kind 
of documentation, that I grant you. But I'd consider that style of coding 
the exceptional case also.

>
> The point is that if you want to start by coding that up, you can with the 
> current system.

OK, noted. If I ever write any D, that will be my preferred style.

> If you have a full program and you want that, you can generate it from the 
> full program with the current system.

I won't be using that feature.

>
> I have yet to see anything you have asked for that the current system 
> can't give you. It just doesn't give it to you in exactly the same way C 
> does.

Apparently it does! No?





More information about the Digitalmars-d mailing list