Bug #6068
closed
    String::Hash documentation clarification
Description
modified documentation for String::hash to clarify that results are not conistent across sessions and advice for if that behavior is desired
Files
        
          
          Updated by marcandre (Marc-Andre Lafortune) over 13 years ago
          
          
        
        
      
      I'm not sure that all implementations have to return hash codes that differ from one run to the other. I would also modify Object#hash, as all hashes in CRuby are random seeded, not just String. I'd recommend adding the following line to Object#hash:
No other assumption can be made on hash values; in particular they may vary between sessions or implementations.
        
          
          Updated by drbrain (Eric Hodel) over 13 years ago
          
          
        
        
      
      - Status changed from Open to Closed
 - % Done changed from 0 to 100
 
This issue was solved with changeset r34769.
Daniel, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- object.c (rb_obj_hash):  Added note that the hash value is not
deterministic on Marc-Andre's suggestion. Expanded description of
the purpose of the hash method. [Bug #6068] 
        
          
          Updated by drbrain (Eric Hodel) over 13 years ago
          
          
        
        
      
      Daniel, I couldn't use your patch as it was not line-wrapped to 80 columns and was too-specific to String. As Marc-Andre pointed out, the randomization behavior applies to Fixnum, Hash, String, Symbol, Array, etc., so I applied a patch based on his suggestion.