From: dblack@... Date: 2002-11-27T23:19:26+09:00 Subject: Re: each_with_index & collect_with_index? Hi -- On Wed, 27 Nov 2002, Austin Ziegler wrote: > On Wed, 27 Nov 2002 14:51:41 +0900, Alan Chen wrote: > > > ary.map { |e,f,g| > > ei = Enumerable.iteration_info > > #... > > } > > I like that, sort of. It still has the problem that a global does; > why not make it an importable method for Enumerable? > > ary.map { |e, f, g| > ei = ary.iteration_info > #... > } > > This doesn't work in cases where the same Enumerable could be > iterated more than once (either by Threading or by nesting), but I > think that those are pathological cases anyway. Not necessarily.... but also, given that all of this is to avoid either *_with_index or a manually-incremented loop variable, it's probably not worth having it equate to a decision that certain other constructs (threading or nesting) are to be avoided. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav