From: "marcandre (Marc-Andre Lafortune)" Date: 2012-12-09T10:44:44+09:00 Subject: [ruby-core:50702] [ruby-trunk - Bug #7248] Shouldn't Enumerator::Lazy.new be private? Issue #7248 has been updated by marcandre (Marc-Andre Lafortune). Oh, interesting. I'll do my best to document it, then. This leads to more questions, though: 1) Is there a use case for the form without a block? It's used internally (before calling lazy_set_method), but other than that I can't see a good use. 2) Is there a use case for specifying a symbol and arguments? Again, internally we call lazy_set_method, to the symbol and arguments are only used by inspect, right? 3) Is there a good way to improve the `inspect` of such a lazy enum? p [11,12,13].filter_map{|i| i*i if i.even?} # => #:each> Notice the `each` and no appearance of `filter_map` Doing `Lazy.new(self, :filter_map)` does not work and seems redundant. Thanks BTW, ultimately, I'm trying to see if Lazy.new can be adapted to accept a `size` lambda argument... ---------------------------------------- Bug #7248: Shouldn't Enumerator::Lazy.new be private? https://bugs.ruby-lang.org/issues/7248#change-34548 Author: marcandre (Marc-Andre Lafortune) Status: Assigned Priority: Normal Assignee: yhara (Yutaka HARA) Category: core Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-10-29 trunk 37380) [x86_64-darwin10.8.0] Is there a reason why Enumerator::Lazy.new is not private? Lazy enumerators should be created with `Enumerable#lazy`. Moreover, there is no doc, and it can give unexpected results too. -- http://bugs.ruby-lang.org/