I have learned that instances of records do not eval to themselves. This seems inconsistent to me. I am curious if this is intentional or if it is a gap in the current record implementation in Clojure.
Thanks. -David ---- (defn eval-type [x] (class (eval x))) ;; instances of structural types evaluate to themselves (eval-type {:a 100}) ;; -> clojure.lang.PersistentArrayMap (eval-type [100]) ;; -> clojure.lang.PersistentVector ;; instances of java objects evaluate to themselves (eval-type "hello") ;; -> java.lang.String (eval-type (java.util.Date.)) ;; -> java.util.Date (eval-type (java.util.Locale. "en" "US")) ;; -> java.util.Locale ;; but instances of records... (defrecord Foo [a]) (eval-type (Foo. 100)) ;; -> clojure.lang.PersistentArrayMap ;; .. evaluate to maps not instances of the record class? -- 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