From: "marcandre (Marc-Andre Lafortune)" <ruby-core@...>
Date: 2013-01-17T03:27:37+09:00
Subject: [ruby-core:51472] [ruby-trunk - Bug #7706][Open] Lazy#zip should not call `lazy`


Issue #7706 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Bug #7706: Lazy#zip should not call `lazy`
https://bugs.ruby-lang.org/issues/7706

Author: marcandre (Marc-Andre Lafortune)
Status: Open
Priority: Normal
Assignee: marcandre (Marc-Andre Lafortune)
Category: core
Target version: 2.0.0
ruby -v: r38825


Current implementation of Lazy#zip has problems:

1) calls `lazy` when this is not excepted, necessary nor documented. Any reason to not call `each` instead?
2) calls `lazy` without checking previously for type:

    [1].lazy.zip(42) # =>NoMethodError: undefined method `lazy' for 42:Fixnum
   # expected same as [1].zip(42), i.e. a TypeError

3) inefficient in the case where all arguments are arrays

I'll address these when I get a chance. I don't understand why `lazy` is called instead of `each` though. Anyone?


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