On Apr 23, 2010, at 3:12 AM, Konrad Hinsen wrote:
On 22 Apr 2010, at 21:15, Konrad Hinsen wrote:
I have several former deftypes that are a perfect fit for the new
defrecord, except that they need a specific comparison function.
This is usually for excluding some fields from equality testing, or
for requiring identity rather than equality for some fields.
What I'd actually like to have for defrecord is an "equality"
protocol that I can implement myself or use a default
implementation. That protocol would have a function "equals"
guaranteed to be called only if the object compared to is of the
same type. Object.equals would take care of type testing and then
call the protocol function. That would remove the check-type-before-
comparing-fields overhead that every equals implementation for
deftype and defrecord currently requires.
There's not much 'overhead' to that check.
Rich
--
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