Hi,

On 20 October 2011 11:28, Nikolai Weibull <now / bitwi.se> wrote:
> According to the documentation, Enumerable#count calls #size on the
> object if it responds to it.
>
> This behavior was removed on October 31, 2009 (in Git
> c0a0aa0c47f2cd5c97a35effb8b073eeb84b7d2d).
>
> The discrepancy between documentation and implementation
> notwithstanding nor the fact that it=92s been two years since the change
> was made, I don=92t think that this was an optimization that should be
> removed on a whim. =A0I have come to depend on this behavior, as I much
> prefer #count as a name to #length and #size in many cases. =A0Yes,
> Array implements its own version of #count that is the same as #size,
> but this isn=92t true for, for example, Hash.
>
> Yes, Ruby 1.9 (or is that 2.0 now?) is still a moving target, but it
> saddens me that changes like these can be made so easily without
> notifying the community and =96 much, much worse =96 without updating the
> relevant documentation.

I totally agree, it seems a consistent and good optimization not worth
to remove.

I once wanted to add that feature back with Marc-Andr=E9's
Enumerable#size{,=3D} patch ( http://redmine.ruby-lang.org/issues/3715
).