# Code Review: HashFixes

**URL:** <https://www.ruby-forum.com/t/code-review-hashfixes/170879>\
**Category:** IronRuby\
**Created:** [June 23, 2009, 10:41pm UTC](https://www.ruby-forum.com/t/code-review-hashfixes/170879 "2009-06-23T22:41:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [June 23, 2009, 10:41pm UTC](https://www.ruby-forum.com/t/code-review-hashfixes/170879/1 "2009-06-23T22:41:12Z")

</div>

tfpt review “/shelveset:HashFixes;REDMOND\tomat”

Fixes implementation of hash methods in REXML and RubyGems. The  
current implementation is incorrect since it sums hash codes of  
subcomponents potentially overflowing to Bignum. This issue is mainly  
exposed when calculating hash of an array. Array#hash calculates its  
hash code by calling hash on each item and converting the result of the  
hash method into Fixnum. So if the result if the hash method is a Bignum  
an error is reported:

class C  
def hash  
100000000000000000000  
end  
end

[C.new].hash # =\> in `hash': bignum too big to convert into`long’  
(RangeError)

Tomas

---

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [June 23, 2009, 11:45pm UTC](https://www.ruby-forum.com/t/code-review-hashfixes/170879/2 "2009-06-23T23:45:42Z")

</div>

How are we going to make sure this gets back into REXML and RubyGems? We  
shouldn’t ship significantly different versions of the Ruby stdlib, as  
people will expect to switch to any version of the stdlib without  
issues.

My first thought is to have someone in the community step up to propose  
these changes to RubyGems and REXML for us, and get them checked in.  
Anyone interested?

~js

---

<div class="post-metadata">

**Author:** ![grujildo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/94ad74/32.png) [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Post date:** [July 1, 2009, 9:09am UTC](https://www.ruby-forum.com/t/code-review-hashfixes/170879/3 "2009-07-01T09:09:22Z")

</div>

No takers? I’ve documented this at  
[http://ironruby.net/Documentation/Ruby\_Standard\_Library/Modifications](http://ironruby.net/Documentation/Ruby_Standard_Library/Modifications) so  
if anyone wants to bite the info is there.

~js
