Thread overview
Documenting contracts in Ddoc
Jan 02, 2014
Ross Hays
Jan 02, 2014
bearophile
Jan 02, 2014
H. S. Teoh
Jan 02, 2014
Gary Willoughby
January 02, 2014
Given that D has contracts built into the language (which is one of my favorite features of D by far) it seems to me that it should be possible to document the pre and post conditions of a contract using a contract section in Ddoc. I have been reading through the documentation on Ddoc to see if this is possible, and haven't seen anything yet, nor have I seen any previous topics on it. Am I missing something or is this just not a feature of Ddoc? Furthermore the same thing would be nice to be able to document invariants for a class.

I am putting this topic in the learn forum because I may be wrong and it may be possible. If, however, it is not possible, that maybe it is worth a official suggestion?
January 02, 2014
Ross Hays:

> I am putting this topic in the learn forum because I may be wrong and it may be possible. If, however, it is not possible, that maybe it is worth a official suggestion?

Currently contracts don't go in DDoc, but they could.

Bye,
bearophile
January 02, 2014
On Thu, Jan 02, 2014 at 03:42:53AM +0000, bearophile wrote:
> Ross Hays:
> 
> >I am putting this topic in the learn forum because I may be wrong and it may be possible. If, however, it is not possible, that maybe it is worth a official suggestion?
> 
> Currently contracts don't go in DDoc, but they could.
[...]

They *should*. This is one of the glaring weak points of DDoc.

A related issue is the ability to pretty-print signature constraints: the latest dmd will (finally!) include sig constraints in the generated docs, but right now it just comes out as a big block of text, which has poor readability. There really should be a way to pretty-print the sig constraint so that it's more readable.


T

-- 
Lottery: tax on the stupid. -- Slashdotter
January 02, 2014
On Thursday, 2 January 2014 at 06:19:53 UTC, H. S. Teoh wrote:
> On Thu, Jan 02, 2014 at 03:42:53AM +0000, bearophile wrote:
>> Ross Hays:
>> 
>> >I am putting this topic in the learn forum because I may be wrong
>> >and it may be possible. If, however, it is not possible, that
>> >maybe it is worth a official suggestion?
>> 
>> Currently contracts don't go in DDoc, but they could.
> [...]
>
> They *should*. This is one of the glaring weak points of DDoc.
>
> A related issue is the ability to pretty-print signature constraints:
> the latest dmd will (finally!) include sig constraints in the generated
> docs, but right now it just comes out as a big block of text, which has
> poor readability. There really should be a way to pretty-print the sig
> constraint so that it's more readable.
>
>
> T

Agreed. More control is definitely needed over this to aid readability. I hate the 'big block of text' that it currently does.