ClojureScript

Inconsistent hashing of empty collections

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    clojurescript 0.0-2496"
    clojure 1.6.0

Description

I get different results when hashing a literal empty vector than when hashing one from read-string, while all the other collections produce the same hash code:

``` clojure
homepage.core> [(hash [2]) (hash (cljs.reader/read-string "[2]"))]
[-1917711765 -1917711765]
homepage.core> [(hash [0]) (hash (cljs.reader/read-string "[0]"))]
[965192274 965192274]
homepage.core> [(hash []) (hash (cljs.reader/read-string "[]"))]
[0 -2017569654] ;; <--- this one looks suspicious.
homepage.core> [(hash {}) (hash (cljs.reader/read-string "{}"))]
[-15128758 -15128758]
homepage.core> (hash #{}) (hash (cljs.reader/read-string "#{}"))
[0 0]
homepage.core> clojurescript-version
"0.0-2496"
```

Activity

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: