Move Set to a core class [Ruby 4.0]#9066
Merged
headius merged 18 commits intojruby:ruby-4.0from Nov 17, 2025
Merged
Conversation
27ee8ab to
d7618b7
Compare
Member
Author
|
Do not merge until we have decided what to do with Ruby 3.5 features. |
Member
Author
|
This can merge into ruby-4.0 any time, but it would be good to finish the listed tasks (they just aren't critical for functionality). |
* Removed SortedSet and related files (gem TBD). * Removed stdlib .rb stub. * Fixed inspect output, intersect? with Array, and infinite enumerables for new tests. * Moved @hash variable to a bound Java field.
* Fix inspect output expectations. * Guard SortedSet tests behind a require, since that collection is now in a separate library (knu/sorted_set). These tests probably should move to the external library once we work out the details (see knu/sorted_set#7)
Based on code from CRuby by Tomoya Ishida: ruby/ruby#13680
When the incoming block's signature is important to the iteration method being called, the previous logic would hide that signature. The change here propagates it through the CallBlock.
This does not exactly match the new native Set impl, but it passes specs and tests related to initialize.
This updates some logic related to the new native Set.
Only fails are now related to us not tracking iteration-in-progress for either Set or Hash.
Paths that will immmediately initialize the wrapped Hash do not need to pre-allocate. This fixes issues with Set.allocate returning an object that has a null Hash and can't be used for anything.
Member
Author
|
Most of this is now implemented, except for the efficient storage format. That will require additional Java hacking to come up with a representation of Set internals that has the following characteristics:
I'll file a separate issue to track that work and we'll hopefully get around to it at some point. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ruby 4.0 will include Set as a core class, minus some old encumbrances. This PR will do the same for JRuby.
TODO:
@hashinstance variable