Bug 14550 – Ditto'ed function documentation should merge parameter lists
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-05-06T20:02:00Z
Last change time
2015-05-06T21:05:03Z
Assigned to
nobody
Creator
andrei
Comments
Comment #0 by andrei — 2015-05-06T20:02:58Z
Consider:
/**
Creates an array of $(D T) using $(D alloc). Lorem ipsum...
Params:
alloc = the allocator used for fetching memory
length = the length of the created array
init = the value used for initializing array elements
range = the range used for initializing array elements
*/
T[] makeArray(T, Allocator)(auto ref Allocator alloc, size_t length);
/// Ditto
T[] makeArray(T, Allocator)(auto ref Allocator alloc, size_t length, auto ref T init);
/// Ditto
T[] makeArray(T, Allocator, R)(auto ref Allocator alloc, R range) if (isForwardRange!R);
/// Ditto
T[] makeArray(T, Allocator, R)(auto ref Allocator alloc, R range) if (isInputRange!R && !isForwardRange!R);
The idea here is that the parameters have disjoint names which allows the reader to easily distinguish where each applies. That makes for compact documentation that avoids repeating the opening (or awkwardly refer to it "like above, but...").
Currently this setup issues warnings during compilation and lists init and range without a type. It should "understand" and list them properly.
Comment #1 by timokhin.iv — 2015-05-06T21:05:03Z
*** This issue has been marked as a duplicate of issue 13270 ***