One problem with requiring the "other" object to be of the same type is that it would break the current model, e.g.:
user=> (= '(1 2 3) [1 2 3]) true I'm left to wonder if it the more correct implementation of the desired behavior is not to override the equals, but rather to implement Comparable. On Apr 23, 12:12 am, Konrad Hinsen <konrad.hin...@fastmail.net> 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. > > Konrad. > > -- > 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 > athttp://groups.google.com/group/clojure?hl=en -- 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