Currently, foreach_reverse on a delegate is equivalent to using foreach on a delegate. A novice user might expect foreach_reverse to somehow force the delegate to iterate its elements in reverse. In order to prevent more bugs being filed on this issue, the documentation should specifically identify that foreach_reverse on a delegate does not reverse the order of iteration, and so should not be used. This is related to bug 1553
It took me a moment to make sense of it. So it basically calls the delegate applied to the body of the foreach statement in the same way as foreach (element; object) calls the object's opApply on the body of the foreach statement? On this basis, surely foreach_reverse over a delegate should be just illegal?
Bug# 1553
In the comments of issue 1553 there are an initiative to add documentation about this issue. *** This issue has been marked as a duplicate of issue 1553 ***
(In reply to comment #3) > In the comments of issue 1553 there are an initiative to add documentation > about this issue. This is *not* a duplicate, it's a direct result of Walter closing bug 1553 saying updating the documentation should be fine. This bug report *is* the initiative to add documentation!
Ah OK. Apologies.
https://github.com/D-Programming-Language/dlang.org/pull/647
Commits pushed to master at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/52c00a22c74e3bfb5be9cbd4c6549b9e8cbdc45f Fix issue 6251: docs should warn about foreach_reverse over delegate. https://github.com/D-Programming-Language/dlang.org/commit/1e29f79e6577a3d0f32fcc36f7de1a438286985d Merge pull request #647 from quickfur/bug6251 Fix issue 6251: docs should warn about foreach_reverse over delegate.
Commits pushed to 2.067 at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/52c00a22c74e3bfb5be9cbd4c6549b9e8cbdc45f Fix issue 6251: docs should warn about foreach_reverse over delegate. https://github.com/D-Programming-Language/dlang.org/commit/1e29f79e6577a3d0f32fcc36f7de1a438286985d Merge pull request #647 from quickfur/bug6251