Project

General

Profile

Bug #7343

Enumerator::Lazy seems to nest herself infinitely

Added by Uchio KONDO about 3 years ago. Updated about 3 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
ruby -v:
ruby 2.0.0dev (2012-11-13) [x86_64-darwin11.4.2]
Backport:
2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
[ruby-core:49286]

Description

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 KONDOudzura@udzura.jp

History

#1 [ruby-core:49287] Updated by Uchio KONDO about 3 years ago

I understand Enumerator::Lazy's behavior via

Sorry for making a noise...

#2 [ruby-core:49309] Updated by Marc-Andre Lafortune about 3 years ago

  • Status changed from Open to Rejected

Also available in: Atom PDF