Clojure

Docstring of defrecord (and =) does not correctly describe equality behavior for records.

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: Release 1.2, Release 1.3, Release 1.4
  • Fix Version/s: Release 1.3, Release 1.4
  • Component/s: None
  • Labels:
    None
  • Approval:
    Accepted

Description

http://groups.google.com/group/clojure/browse_frm/thread/eba691b38c45196b#

The docstring of defrecord says it "will define type-and-
value-based equality and hashCode". In reality, record types are included in = but not .equals (or hashCode), and so records of different types can collide as map keys.

Along the same lines, the docstring of = says "same as Java x.equals, 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.

FWIW I think it would be more clear if the behavior for = and .equals were the same in this respect, but in any case the implemented behavior should be properly documented.

Activity

Aaron Bedra made changes -
Field Original Value New Value
Issue Type Defect [ 1 ] Enhancement [ 4 ]
Assignee Aaron Bedra [ aaron ]
Fix Version/s Release.Next [ 10038 ]
Priority Major [ 3 ] Minor [ 4 ]
Aaron Bedra made changes -
Waiting On richhickey
Aaron Bedra made changes -
Assignee Aaron Bedra [ aaron ] Stuart Halloway [ stu ]
Waiting On richhickey stu
Stuart Halloway made changes -
Fix Version/s Approved Backlog [ 10034 ]
Fix Version/s Release.Next [ 10038 ]
Stuart Halloway made changes -
Status Open [ 1 ] Resolved [ 5 ]
Approval Accepted
Fix Version/s Release.Next [ 10038 ]
Fix Version/s Approved Backlog [ 10034 ]
Resolution Completed [ 1 ]
Fogus made changes -
Affects Version/s Release 1.4 [ 10040 ]
Fogus made changes -
Fix Version/s Release 1.4 [ 10040 ]
Stuart Halloway made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: