On Sat, 30 Aug 2003 02:11:12 +0900, Hal Fulton wrote:
> Austin Ziegler wrote:
>> On Fri, 29 Aug 2003 22:02:01 +0900, Dan North wrote:
>>> So it's undefined behaviour, but "Don't modify the receiver while you
>>> are iterating over it." :)
>> arr.each { |e| arr << f.flatten if f.kind_of?(Array) }
> Well, if I understand Matz correctly, this behavior is not guaranteed.

> If that's the case, you should change this to avoid being bitten the way
> I was.

I donno. I think that this is something "dangerous" that should be 
implicitly permitted. In my case, I needed to process a list of items (order 
didn't matter) and process sublists after everything else. I can't think of 
anything quite as elegant as the above that guarantees that each item will 
only be processed once. (There was more to it than that, but I can't find my 
use of the technique in any case. It must have been less interesting than I 
thought.)

-austin
--
austin ziegler    * austin / halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2003.08.29
                                         * 13.31.57