We need better documentation for functions with ranges and templates

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 14 12:53:53 PST 2015


One thing we definitely need to do is make the template 
constraints rendered better in documentation, and also allow user 
content in them. We've discussed this several times but no clear 
path emerged so far. Maybe a strong champion would come forward?

I'm thinking along the lines of:

* Change ddoc to output the constraint separately under a 
DDOC_CONSTRAINT macro.

* Allow ddoc comments inside macros:

bool isSameLength(Range1, Range2)(Range1 r1, Range2 r2)
if (isInputRange!Range1 && isInputRange!Range2 && 
!isInfinite!Range1 && !isInfinite!Range2
/**
`Range1` and `Range2` must be both non-infinite input ranges.
*/
);

then format that comment as a DDOC_CONSTRAINT_USERTEXT or 
something.

These would be good steps to take.


Andrei


More information about the Digitalmars-d mailing list