Issue #3715 has been updated by Run Paint Run Run.


An enumerator is effectively immutable. The existence of #size= and potentially invoking a Proc for each call to #size, implies that its maximum size will change over the course of the iteration. Is this likely? If not, we can remove #size=, and treat the Proc as a thunk, which would be simpler and faster.

I find the semantics of Enumerator#size's block argument confusing. I suggest that #size accept no arguments, use the `size` Proc, if available, or otherwise fallback to the brute force approach. That is, to find the size of an enumerator, _e_, constrained by a block, _b_, the programmer should call `obj.e(&b).to_enum.size`. It will often be the case that `obj.e(&b)` returns an object that responds to #size itself, allowing the general case of `obj.e(&b).size`.

I'd rather #to_enum/#enum_for take a Proc as an argument rather than a block literal. As methods can only accept a single block, I prefer it affect the method as a whole; not a specific aspect thereof.

Lastly, some of the RDoc needs word wrapping. :-)
----------------------------------------
http://redmine.ruby-lang.org/issues/show/3715

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