I just ran into the following surprise:

user> (defrecord P [])
user.P
user> (defrecord Q [])
user.Q
user> (= (P.) (Q.))
false
user> (.equals (P.) (Q.))
true

This is not a bug (but I do find it confusing -- I did not expect (P.)
and (Q.) to collide as map keys):
http://groups.google.com/group/clojure/browse_frm/thread/7ba5215d59f2f177

However, the docstring of defrecord says it "will define type-and-
value-based equality and hashCode".   Perhaps this could be
clarified?

Along the same lines, the docstring of = says "same as Java
x.equals(y), except it ... compares numbers and collections in a type-
independent manner".   To me, this seems to imply the opposite of what
actually happens with records.

Thanks, Jason



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to