Clojure

PersistentList$EmptyList and empty LazySeq still returns old value for hasheq

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Completed
  • Affects Version/s: Release 1.6
  • Fix Version/s: Release 1.6
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

After late Jan 2014 changes to hash functions, PersistentList$EmptyList and (lazy-seq) were left behind:

user=> (= '() (lazy-seq) [])
true
user=> (map hash ['() (lazy-seq) []])
(1 1 -2017569654)
user=> (map class ['() (lazy-seq) []])
(clojure.lang.PersistentList$EmptyList clojure.lang.LazySeq clojure.lang.PersistentVector)

PersistentQueue/EMPTY was updated, so should not need any change.

Solution: Update LazySeq.hasheq() and make EmptyList implement IHashEq. EmptyList now creates a static constant for the hash value of an empty ordered collection and returns the constant for hasheq. An alternative would be to have Murmur3 have this constant instead.

Patch: clj-1335-v2.patch
Depends on: CLJ-1338, CLJ-1339, CLJ-1331 (must be applied first)

Patch:

  1. clj-1335-v1.diff
    30/Jan/14 6:33 PM
    6 kB
    Andy Fingerhut
  2. clj-1335-v2.patch
    04/Feb/14 5:13 PM
    5 kB
    Alex Miller

Activity

Andy Fingerhut made changes -
Field Original Value New Value
Description After late Jan 2014 changes to hash functions, PersistentList$EmptyList was left behind:
{code}
user=> (= '() [])
true
user=> (map hash ['() []])
(1 -2017569654)
user=> (map class ['() []])
(clojure.lang.PersistentList$EmptyList clojure.lang.PersistentVector)
{code}
After late Jan 2014 changes to hash functions, PersistentList$EmptyList and (lazy-seq) were left behind:
{code}
user=> (= '() (lazy-seq) [])
true
user=> (map hash ['() (lazy-seq) []])
(1 1 -2017569654)
user=> (map class ['() (lazy-seq) []])
(clojure.lang.PersistentList$EmptyList clojure.lang.LazySeq clojure.lang.PersistentVector)
{code}
PersistentQueue/EMPTY was updated, so should not need any change.
Summary PersistentList$EmptyList still returns old value for hasheq PersistentList$EmptyList and empty LazySeq still returns old value for hasheq
Andy Fingerhut made changes -
Attachment clj-1335-v1.diff [ 12733 ]
Alex Miller made changes -
Approval Vetted [ 10003 ]
Alex Miller made changes -
Patch Code and Test [ 10002 ]
Alex Miller made changes -
Fix Version/s Release 1.6 [ 10157 ]
Alex Miller made changes -
Priority Major [ 3 ] Blocker [ 1 ]
Alex Miller made changes -
Description After late Jan 2014 changes to hash functions, PersistentList$EmptyList and (lazy-seq) were left behind:
{code}
user=> (= '() (lazy-seq) [])
true
user=> (map hash ['() (lazy-seq) []])
(1 1 -2017569654)
user=> (map class ['() (lazy-seq) []])
(clojure.lang.PersistentList$EmptyList clojure.lang.LazySeq clojure.lang.PersistentVector)
{code}
PersistentQueue/EMPTY was updated, so should not need any change.
After late Jan 2014 changes to hash functions, PersistentList$EmptyList and (lazy-seq) were left behind:

{code}
user=> (= '() (lazy-seq) [])
true
user=> (map hash ['() (lazy-seq) []])
(1 1 -2017569654)
user=> (map class ['() (lazy-seq) []])
(clojure.lang.PersistentList$EmptyList clojure.lang.LazySeq clojure.lang.PersistentVector)
{code}
PersistentQueue/EMPTY was updated, so should not need any change.

*Solution:* Update LazySeq.hasheq() and make EmptyList implement IHashEq. EmptyList now creates a static constant for the hash value of an empty ordered collection and returns the constant for hasheq. An alternative would be to have Murmur3 have this constant instead.

*Patch:* clj-1335-v2.patch
*Depends on:* CLJ-1338, CLJ-1339, CLJ-1331 (must be applied first)


*Patch:*
Attachment clj-1335-v2.patch [ 12756 ]
Stuart Halloway made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: