Well. I totally agree that value equality is the correct approach. And I am very happy it is the default.
But, in some situations, you want to have accessors but do want to have identity as an equality. You cannot use identical? in Clojure data structures, for example. I am in a situation where I know, by construction, that equality is identity. It's a bit of a problem to test for equality at each insertion and deletion. (Especially because I have deep trees). I think having an option allowing that would be useful, at least to me. (I agree, I can write my own accessors, but it make things a lot harder to generate with macros) Best regards, Nicolas. On Sat, Jul 17, 2010 at 6:01 PM, ataggart <alex.tagg...@gmail.com> wrote: > No. Use identical? if you want to test for object identity. IIRC > Rich commented that the inability to override equals/hashCode was > intentional as value equality was the correct approach. See > http://clojure.org/state > > > On Jul 17, 7:00 am, Nicolas Oury <nicolas.o...@gmail.com> wrote: > > Dear all, > > > > I was wondering if they were a way to define a record type with identity > as > > an equality semantic? > > > > (defrecord A[] > > Object > > (hashCode ...) > > (equals ...)) > > do not work. > > > > Is there a way to do that? > > > > (Defining a deftype around the defrecord is a bit annoying) > > > > Best regards, > > > > Nicolas. > > -- > 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<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://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