From: Yukihiro Matsumoto Date: 2007-12-25T12:38:15+09:00 Subject: Re: Enumerable#to_a can run forever Hi, In message "Re: Enumerable#to_a can run forever" on Tue, 25 Dec 2007 11:27:29 +0900, Benjamin Kudria writes: |Aaah, ok. Those would be excellent. I look forward to 1.9! Thank you! |However, what about Prime.new.to_a ? That would still run forever, and |the unsuspecting coder might be caught by surprise. It's no way to avoid entering infinite loop when you do some operations on infinite enumerable, such as Prime. For example, trying #sort or #max on Prime, or even putting it as a splat will cause infinite loop. Adding an argument or a block to #to_a does not improve the situation a lot, I think. matz.