On Jul 29, 11:51 pm, Ryan Twitchell <metatheo...@gmail.com> wrote: > Hi all, > > I noticed (with a very recent git pull) the following asymmetric > behavior regarding = and records: > > (defrecord my-record [a]) > > (def r (new my-record 1)) > (def s (new my-record 1)) > > (= r s) ;; true > (= s r) ;; true > (= r {:a 1}) ;; false > (= {:a 1} r) ;; true > > Is this intentional? (I hope not) > > Also, what prompted this was my trying to do the following. In > general, what kind of behavior should we expect to see when mixing > records and other map types? > > (replace {{:a 1} (new my-record 2)} [(new my-record 1)]) > > Currently this produces [#:user.my-record{:a 1}], where I was hoping > to get [#:user.my-record{:a 2}]
This, and several other symmetry problems, are now fixed: http://github.com/clojure/clojure/commit/ac484ba40cc1d94d42ce59e9df92b13e98ed0b6e The policy is: = includes the type and .equals doesn't. In this way records can still be proper j.u.Maps and = remains most useful for records (e.g. including type). Thanks for the report, 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