Re: bidirectional iterators
by Larry Wall other posts by this author
Aug 30 2004 7:12PM messages near this date
bidirectional iterators
|
Re: Return with no expression
On Mon, Aug 23, 2004 at 03:31:39PM -0700, David Storrs wrote:
: There has been a lot of discussion in the other threads lately about
: iterators. I was wondering if there will be an easy way to create a
: bidirectional iterator? Toy example to show what I'm thinking:
:
: for(1..10) {
: next if /7/; # always skip 7
: prev if 9 && !rand 3; # occasionally backup and redo 8
:
: print;
: }
My feeling on the matter is that there are some object types that can
support bidirectional iterators, and it's fine to call .prev on such
an object explicitly, but supporting such on the implicit list of a
loop is probably overkill for the number times people will actually
want it. In fact, nobody has ever asked for it before...
Larry
Thread:
David Storrs
Larry Wall
|