There should be a way to rehash a
s = Set.new([]) s.first << 1 # s.rehash # Does not exist! s.include?  # => false, want true
#5 [ruby-core:50060] Updated by marcandre (Marc-Andre Lafortune) almost 5 years ago
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
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
#6 [ruby-core:56223] Updated by knu (Akinori MUSHA) about 4 years ago
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)