Project

General

Profile

Actions

Bug #9231

closed

The value of [].hash is equal to the value of false.hash

Added by phasis68 (Heesob Park) over 10 years ago. Updated over 10 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.1.0dev (2013-12-09 trunk 44080) [x64-mswin64_120]
[ruby-core:58993]

Description

I found that [].hash == false.hash.
And the combinations of each elements also have the same value.
Is this an intended behavior?

C:\Users\phasis>irb
irb(main):001:0> [].hash
=> 1336528015
irb(main):002:0> false.hash
=> 1336528015

irb(main):003:0> [false,false].hash
=> -1570892633
irb(main):004:0> [false,[]].hash
=> -1570892633
irb(main):005:0> [[],false].hash
=> -1570892633
irb(main):006:0> [[],[]].hash
=> -1570892633

irb(main):008:0> {false=>false}.hash
=> -539662806
irb(main):009:0> {[]=>[]}.hash
=> -539662806
irb(main):010:0> {[]=>false}.hash
=> -539662806
irb(main):011:0> {false=>[]}.hash
=> -539662806

Actions

Also available in: Atom PDF

Like0
Like0