[ruby-core:49286] [ruby-trunk - Bug #7343][Open] Enumerator::Lazy seems to nest herself infinitely

2 views
Skip to first unread message

udzura (Uchio KONDO)

unread,
Nov 13, 2012, 2:42:33 AM11/13/12
to ruby...@ruby-lang.org

Issue #7343 has been reported by udzura (Uchio KONDO).

----------------------------------------
Bug #7343: Enumerator::Lazy seems to nest herself infinitely
https://bugs.ruby-lang.org/issues/7343

Author: udzura (Uchio KONDO)
Status: Open
Priority: Low
Assignee:
Category:
Target version: 2.0.0
ruby -v: ruby 2.0.0dev (2012-11-13) [x86_64-darwin11.4.2]


Hello, Ruby dev team.

I tried Ruby 2.0 trunk, and found Enumerator::Lazy a bit weird.

> [1, 2, 3].cycle.lazy.take 5
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: [1, 2, 3]:cycle>>:take(5)>

> [1, 2, 3].cycle.lazy.take_while {|i| i < 3 }.lazy.take(2)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: [1, 2, 3]:cycle>>:take_while>:take(2)>

> [1, 2, 3].cycle.lazy.take_while {|i| i < 3 }.lazy.take(2).lazy.take(3).lazy
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: [1, 2, 3]:cycle>>:take_while>:take(2)>:take(3)>

Is this type of infinite nesting desirable?

Thank you,
Uchio KONDO<udz...@udzura.jp>


--
http://bugs.ruby-lang.org/

udzura (Uchio KONDO)

unread,
Nov 13, 2012, 3:59:45 AM11/13/12
to ruby...@ruby-lang.org

Issue #7343 has been updated by udzura (Uchio KONDO).


I understand Enumerator::Lazy's behavior via

- https://twitter.com/mashiro/status/268271989964292096
- https://gist.github.com/1939610

Sorry for making a noise...
----------------------------------------
Bug #7343: Enumerator::Lazy seems to nest herself infinitely
https://bugs.ruby-lang.org/issues/7343#change-32843

marcandre (Marc-Andre Lafortune)

unread,
Nov 13, 2012, 10:44:29 AM11/13/12
to ruby...@ruby-lang.org

Issue #7343 has been updated by marcandre (Marc-Andre Lafortune).

Status changed from Open to Rejected


----------------------------------------
Bug #7343: Enumerator::Lazy seems to nest herself infinitely
https://bugs.ruby-lang.org/issues/7343#change-32866

Author: udzura (Uchio KONDO)
Status: Rejected
Reply all
Reply to author
Forward
0 new messages