www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3017] New: doc errors in std.range (on behalf of Steven Schveighoffer)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3017

           Summary: doc errors in std.range (on behalf of Steven
                    Schveighoffer)
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: ASSIGNED
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: andrei metalanguage.com
        ReportedBy: andrei metalanguage.com


Just getting more familiar with ranges in D2, I saw the following errors in the
docs:

isInfinite: Specifies that the range must have a static member that equals
false, but it really should say that the range must have a static member *named
empty* that equals false.

advance:  mislabel, "The pass of r into *drop* is by reference", should be
advance, not drop.

retreatN: similar issue as advance, example also has mislabel.

SListRange: popFront,front: last sentence either reference a hidden member
"input" or is a copy-paste error.

=====

Couple comments I thought of, could have made another post, but...

1. advance is O(n) if slicing is not offered.  However, an infinite range
doesn't, and shouldn't, offer slicing.  But it might be able to advance n
elements in constant time if each element is well defined without a recurrence.

You may want to implement some sort of skip function, which advance uses if
slicing isn't available, and it can be supported.

For example, an infinite range of 1 to infinity could be easily skipped n
elements.  However, you don't want to offer a slice function, because the
result might or might not be an infinite range (depending on if the second
argument to the slice is $).

A stream may need a similar function.  For example, skipping n bytes could be a
quick operation.  skip should only be defined if it can be done faster than
repeatedly calling popFront.

2. Transversal, I would think, should continue to iterate over the elements
that are left (if so desired).  That is, given two ranges such as:

[1,2,3]
[4,5,6]

I would think a useful range over this would result in:

[1,4,2,5,3,6]

-Steve

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 22 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3017


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED





22:15:02 PDT ---
Thanks for the comments and suggestions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 27 2009