Actions
Bug #1871
closedHash#compare_by_identity Does Not Persist Over #dup or #clone
    Bug #1871:
    Hash#compare_by_identity Does Not Persist Over #dup or #clone
  
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-08-03 trunk 24372) [i686-linux]
Backport:
Description
=begin
The "ident"ness of a Hash doesn't persist over #dup or #clone which makes those methods destructive when they rehash. Given that normally hash == hash.dup, and that default procs are retained over these two operations, I assume this is a bug.
h = {'foo' => 'bar'}
h.compare_by_identity
h['foo'] = 'glark'
p h                       #=> {"foo"=>"bar", "foo"=>"glark"}
p h.compare_by_identity?  #=> true
j = h.dup
p j                       #=> {"foo"=>"glark"}
p j.compare_by_identity?  #=> false
k = h.clone
p k                       #=> {"foo"=>"glark"}
p k.compare_by_identity?  #=> false
=end
        
          
          Updated by matz (Yukihiro Matsumoto) over 16 years ago
          
          
        
        
      
      - Status changed from Open to Closed
 - % Done changed from 0 to 100
 
=begin
Applied in changeset r24382.
=end
Actions