Actions
Bug #8801
closed
Splatted assignment with Enumerator::Lazy
Bug #8801:
Splatted assignment with Enumerator::Lazy
Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-08-18) [x86_64-darwin11.4.2]
Backport:
Description
Actual:
a = [1,2,3].lazy
=> #<Enumerator::Lazy: [1, 2, 3]>
b, *c = a
=> #<Enumerator::Lazy: [1, 2, 3]>
b
=> #<Enumerator::Lazy: [1, 2, 3]>
c
=> []
Expected:
a = [1,2,3].lazy
=> #<Enumerator::Lazy: [1, 2, 3]>
b, *c = a
=> #<Enumerator::Lazy: [1, 2, 3]>
b
=> 1
c
=> [2, 3]
Basically, I expect a lazy array to act like a non-lazy one, and that using a destructuring assignment like this is basically the same as calling #take(1) and #drop(1).
Actions