D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8087 - Improve clarity of std.algorithm documentation
Summary: Improve clarity of std.algorithm documentation
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: Alexandru Razvan Caciulescu
URL:
Keywords: bootcamp
Depends on:
Blocks: 16614
  Show dependency treegraph
 
Reported: 2012-05-11 12:21 UTC by Walter Bright
Modified: 2017-01-16 23:24 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2012-05-11 12:21:36 UTC
1. copy's prototype is:

  Range2 copy(Range1, Range2)(Range1 source, Range2 target);

It would be more self-documenting written as:

  OutputRange copy(InputRange, OutputRange)(InputRange source, OutputRange target);

In general, for all the algorithms that deal with ranges, the range types should be named after the type of range expected - ForwardRange, InputRange, BidirectionalRange, etc.


2. map has inconsistent use of element names - calling it x in the description and e in the example code. Should use the same name in each. Check other descriptions for similar issues.


3. joiner should include a "See Also" link to the very similar std.range.chain
Comment 1 bearophile_hugs 2014-11-10 09:22:10 UTC
(In reply to Walter Bright from comment #0)

> In general, for all the algorithms that deal with ranges, the range types
> should be named after the type of range expected - ForwardRange, InputRange,
> BidirectionalRange, etc.

It's even conceivable for the compiler to enforce this wise rule.
Comment 2 github-bugzilla 2014-11-11 22:30:38 UTC
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/a33ef931bfcbea3278a66fee729c6cc9da0089f3
Merge pull request #2668 from quickfur/issue8087

Partial fix for issue 8087: improve std.algorithm documentation
Comment 3 hsteoh 2014-11-19 16:18:25 UTC
Now that sig constraints are included in ddoc's output, is (1) still an issue? The declaration of std.algorithm.copy is now:

Range2 copy(Range1, Range2)(Range1 source, Range2 target) if (isInputRange!Range1 && isOutputRange!(Range2, ElementType!Range1));

(2) and (3) have been addressed by the PR that merged.
Comment 4 github-bugzilla 2015-02-18 03:39:43 UTC
Commit pushed to 2.067 at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/a33ef931bfcbea3278a66fee729c6cc9da0089f3
Merge pull request #2668 from quickfur/issue8087
Comment 5 Alexandru Razvan Caciulescu 2016-10-30 18:46:40 UTC
https://github.com/dlang/phobos/pull/4883

Regarding (1), since this bug was created the file hierarchy seems to have changed. I updated the files from std/algorithm as explained in the original post. Awaiting feedback.
Comment 6 Alexandru Razvan Caciulescu 2016-10-30 18:48:16 UTC
https://github.com/dlang/phobos/pull/4883

Regarding (1), since this bug was created the file hierarchy seems to have changed. I updated the files from std/algorithm as explained in the original post. Awaiting feedback.
Comment 7 github-bugzilla 2016-11-01 22:23:38 UTC
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/946a46774c58681036e12932858d0bb58f887448
Fix Issue 8087 - Improve clarity of std.algorithm documentation

https://github.com/dlang/phobos/commit/fd518eb310a9494cccf28c54892542b052c49669
Merge pull request #4883 from Darredevil/issue-8087

Fix Issue 8087 - Improve clarity of std.algorithm documentation
Comment 8 github-bugzilla 2016-12-27 13:11:09 UTC
Commits pushed to scope at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/946a46774c58681036e12932858d0bb58f887448
Fix Issue 8087 - Improve clarity of std.algorithm documentation

https://github.com/dlang/phobos/commit/fd518eb310a9494cccf28c54892542b052c49669
Merge pull request #4883 from Darredevil/issue-8087
Comment 9 github-bugzilla 2017-01-07 03:02:26 UTC
Commits pushed to stable at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/946a46774c58681036e12932858d0bb58f887448
Fix Issue 8087 - Improve clarity of std.algorithm documentation

https://github.com/dlang/phobos/commit/fd518eb310a9494cccf28c54892542b052c49669
Merge pull request #4883 from Darredevil/issue-8087
Comment 10 github-bugzilla 2017-01-16 23:24:25 UTC
Commits pushed to newCTFE at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/946a46774c58681036e12932858d0bb58f887448
Fix Issue 8087 - Improve clarity of std.algorithm documentation

https://github.com/dlang/phobos/commit/fd518eb310a9494cccf28c54892542b052c49669
Merge pull request #4883 from Darredevil/issue-8087