D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5910 - Stride members' documentation comments are wrong
Summary: Stride members' documentation comments are wrong
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dlang.org (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: Andrei Alexandrescu
URL: http://www.digitalmars.com/d/2.0/phob...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-29 21:39 UTC by Andrej Mitrovic
Modified: 2012-01-04 07:28 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2011-04-29 21:39:22 UTC
It seems the following std.range Stride members have the exact same comments as Retro. I guess it was a case of copy & paste, and its reflected in the online documentation:

opIndex(size_t n);
    Forwards to input[input.length - n + 1]. Defined only if R is a random access range and if R defines R.length.

void opIndexAssign(ElementType!(R) val, size_t n);
    Forwards to input[input.length - n + 1]. Defined only if R is a random access range and if R defines R.length.

ElementType!(R) moveAt(size_t index);
    Forwards to input[input.length - n + 1]. Defined only if R is a random access range and if R defines R.length.

typeof(this) opSlice(size_t a, size_t b);
    Forwards to input[input.length - n + 1]. Defined only if R is a random access range and if R defines R.length.

---------------

These are all wrong. The first one should be:
'''
opIndex(size_t n);
    Forwards to input[n * n]. Defined only if R is a random access range and if R defines R.length.
'''

and the rest need to be updated based on the implementation. (I think all of these should be replaced with "input[n * n]")
Comment 1 kennytm 2011-04-30 03:50:23 UTC
Better not conflate the two "n"s :)

opIndex(size_t i);
    Forwards to input[i * n]. (etc.)
Comment 2 Andrej Mitrovic 2011-04-30 06:50:37 UTC
Oh right, it's _n * n in the code. I think a better name for "_n" is 'step'.
Comment 3 Andrej Mitrovic 2012-01-04 07:28:39 UTC
Stride is gone and was replaced with an auto return function 'stride'. All of that documentation is gone now.