From: Marcin 'Qrczak' Kowalczyk Date: 2002-11-17T19:22:41+09:00 Subject: Re: Array#next - Enumerable#next ? Fri, 15 Nov 2002 10:41:45 +0900, ahoward pisze: > i don't view this as a problem - you are viewing the next method as an > iterator, which in definitively is not. it is an instance method of Array, > and uses instance variables. i would define Array#next as the the next > object the Array is willing to give me. It puts the state of an iteration over the array inside the array, which is evil, even if looks convenient. Traps: - Iteration within another iteration. - Iteration from different threads. - Aborting an iteration early and then starting it again without resetting the iteration state. > if you call a method manipulating Array#size, from another method > manipulating Array#size - would you be suprised that size had > changed? No, because I'm changing the array. But in the above I'm not changing the array, only iterate over it. In other words it turns a non-destructive operation of iterating over the array into a destructive operation which modifies the array. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/