Hi there,
I realise my original message was rambly and didn't provide
cut-and-paste demostrations of the bugs. Let me try again, to see if I
can be clearer.
I would like to know the answers to two questions: should I file JIRA
tickets for these bugs? Should I attach patches?
--------------
1) PersistentQueue equality bug (already filed as CLJ-1059, but not vetted)
(def al (doto (java.util.ArrayList.) (addAll [1 2 3])))
(def q (conj clojure.lang.PersistentQueue/EMPTY 1 2 3))
[(= al [1 2 3]) (= [1 2 3] q) (= al q)]
;=> [true true false]
I expect [true true true] here, preserving transitivity of equality.
-----------------
2) PersistentQueue hashing doesn't match equality (not currently filed)
(def iq (conj clojure.lang.PersistentQueue/EMPTY (Integer. -1)))
(def lq (conj clojure.lang.PersistentQueue/EMPTY (Long. -1)))
[(= iq lq) (= (hash iq) (hash lq))]
;=> [true false]
I expect [true true] here, because if two values are equal they should
have the same hashcode. This means that you can put two equals into a
set:
#{iq lq}
;=> #{#<PersistentQueue clojure.lang.PersistentQueue@9e3779b8>
#<PersistentQueue clojure.lang.PersistentQueue@9e3779b9>}
I expect either IllegalArgumentException: Duplicate key, or a set with
size 1 here. I shouldn't get a set with size 2.
---------------------
3) PersistentQueue hashing doesn't match List hashing (not currently filed)
(def q (conj clojure.lang.PersistentQueue/EMPTY 1 2 3))
[(= [1 2 3] q) (= (hash [1 2 3]) (hash q))]
;=> [true false]
I expect [true true], because if two values are equal they should have
the same hashcode. Again you can put two equals into a set:
#{[1 2 3] q}
;=> #{[1 2 3] #<PersistentQueue clojure.lang.PersistentQueue@6b58d153>}
-----------------
Once again: should I file tickets? Should I attach patches?
(Am I following the process correctly here? According to
http://dev.clojure.org/display/design/JIRA+workflow it looks like I
shouldn't file a ticket til I've received approval on this list, and I
shouldn't file a patch til the ticket itself has been vetted. Is this
correct? If people accept these are genuine bugs, I'm ready to file
patches straight away!)
Phil