[Issue 5691] walkLength() compatible with opApply()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 4 05:47:26 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5691


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com


--- Comment #10 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-03-04 05:44:27 PST ---
Couldn't walkLength simply be redefined to accept an isIterable argument?  That
covers ranges, opApply, and properly formed delegates.

And to answer Jonathan, opApply has very important features that ranges do not.
 First and foremost, it can use the stack for iteration.  This allows things
like indexed iteration, iterating trees, and efficient iterating via a virtual
interface.

Second, ranges do not yet allow more than one item while iterating.  I can't
do:

foreach(i, x; r)

on a range.

Not saying opApply is better in all cases, ranges do have just as important
features, but opApply is more useful in certain important situations.

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


More information about the Digitalmars-d-bugs mailing list