Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A negative `size` makes no sense at all, -infinity even less so. It is indeed the case that Ruby currently returns `-infinity` (even if you take the product of two of these senseless enumerables), but that doesn't make it a _valid spec_. It does so because it is simpler to test for ±infinity than it is to test for +infinity... Other alternative implementations should attempt to mimick such behaviour. One could argue it is a bug (and `nil` should be returned maybe, but that would be the case for any negative `size`), or that the current result is acceptable because "garbage in garbage out", but nobody in their right mind would rely on this behavior and clearly returning `nil` or raising an exception are better results than returning - infinity. This PR takes to leave this uninteresting and ill-defined corner case as implementation dependent.
- Loading branch information