From: "knu (Akinori MUSHA)" <knu@...>
Date: 2013-07-27T15:48:44+09:00
Subject: [ruby-core:56223] [ruby-trunk - Feature #6589] Set#rehash


Issue #6589 has been updated by knu (Akinori MUSHA).


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
- ...

----------------------------------------
Feature #6589: Set#rehash
https://bugs.ruby-lang.org/issues/6589#change-40711

Author: marcandre (Marc-Andre Lafortune)
Status: Assigned
Priority: Normal
Assignee: knu (Akinori MUSHA)
Category: lib
Target version: next minor


There should be a way to rehash a `Set`.

    s = Set.new([[]])
    s.first << 1
    # s.rehash # Does not exist!
    s.include? [1] # => false, want true

See also:

http://stackoverflow.com/questions/10992423/is-this-expected-behaviour-for-a-set-of-arrays-in-ruby
http://stackoverflow.com/questions/10361400/deleting-a-modified-object-from-a-set-in-a-no-op




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