Issue #13840 has been reported by MSP-Greg (Greg L).

----------------------------------------
Misc #13840: Collection methods - stability
https://bugs.ruby-lang.org/issues/13840

* Author: MSP-Greg (Greg L)
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
I'm trying to fix some method code (`Gem::Resolver#search_for`) in rubygems.

Regardless, in simplifying the code, I was left with one question regarding all of the sort/filter group methods in ruby.

Which ones are considered stable, or, is original order maintained where applicable?

Obviously, this pertains to `sort` and `sort_by`, but also has meaning in `group_by`, `select`, `reject`, and similar methods.

I'm not proposing one or another, although I'd prefer stable.  Docs for all these methods should note this, and if stability is guaranteed, tests should verify it.  Happy to help.

As an aside, `Gem::Resolver#search_for` exists in both [ruby](https://github.com/ruby/ruby/blob/21e4ade56b4261c549fd03f96f4430946d028bea/lib/rubygems/resolver.rb#L225-L235) and [rubygems](https://github.com/rubygems/rubygems/blob/d5de035229fc5745e17cfa56b3f3ebe30f537468/lib/rubygems/resolver.rb#L225-L256), but is different.  Also, a test for it exists in rubygems, but not in ruby.  Seems odd.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>