www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Documenting contracts in Ddoc

reply "Ross Hays" <accounts rosshays.net> writes:
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?
Jan 01 2014
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
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
Jan 01 2014
parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
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
Jan 01 2014
parent "Gary Willoughby" <dev nomad.so> writes:
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.
Jan 02 2014