Hello,
2012/4/4 gregolsen (Innokenty Mikhailov) <anotheroneman / yahoo.com>:
> Here's the new patch attached - problem, mentioned by Yusuke Endoh, fixed - now I'm creating a new copy of enumerator on each lazy method call.
Okay, the next problem :-)
(1..10).lazy.select {|x| false }.map {|x| p x }.to_a
should print nothing, but it actually prints 1, 2, ..., 10
with your patch applied. It can be fixed easily, though.
I glanced your patch. It will degrade functional modularity
in enumerator.c. Currently, it not so big problem because
it only implements #map and #select. But I guess implementing
other methods, especially, #cycle and #zip, will make some
functions (process_element and lazy_iterator_block) complex
and hard to maintain.
Thus, until you create the final patch, it is hard to say
whether we can import your patch or not.
--
Yusuke Endoh <mame / tsg.ne.jp>