Feature #6589
closed
- Status changed from Open to Assigned
- Target version changed from 2.0.0 to 2.6
Comment about this trivial but needed feature would be appreciated.
Is it specified that Set must be hashtable-based forever? There are alternate ways to implement a Set.
headius (Charles Nutter) wrote:
Is it specified that Set must be hashtable-based forever? There are alternate ways to implement a Set.
Alternate ways of implementing Set with check/insertion in O(1) that would also work if structures change without a rehash
functionality?
In any case, the documentation states that "Set uses Hash as storage", but more importantly that "The equality of each couple of elements is determined according to Object#eql?
and Object#hash"
.
Actually, an undocumented "feature" is that Set does not support an element being modified once it is added.
Maybe we should "clarify" that in the document, or add such a method that recalculates identities of elements. I'm yet to decide which, and the name we could give it.
- rehash (let's be honest)
- reset (re-set the set)
- sync
- ...
- Status changed from Assigned to Feedback
I added some notes to the rdoc in r42265.
- Related to Bug #12970: == Equality of recursive sets fails added
- Status changed from Feedback to Closed
Applied in changeset trunk|r60360.
Add Set#reset
This method resets the internal state of a set after modification to
existing elements, reindexing and deduplicating them. [Feature #6589]
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0