Forum: Ruby-core [ruby-trunk - Bug #7706][Open] Lazy#zip should not call `lazy`

Posted by marcandre (Marc-Andre Lafortune) (Guest)
on 2013-01-16 19:28
(Received via mailing list)
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?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.