--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
user=> (use 'no.disassemble)
user=> (definterface P (testfn []))
user=> (defrecord R1 [x y] P (testfn [this] (reset! x (inc @y)) (reset! y (inc @x))))
user=> (deftype R2 [x y] P (testfn [this] (reset! x (inc @y)) (reset! y (inc @x))))
user=> (println (disassemble R1))
user=> (println (disassemble R2))
As a side note, as an experiment I just tried overriding Object.equals
and Object.hashCode with a defrecord, and I got a compiler error:
CompilerException java.lang.ClassFormatError: Duplicate method
name&signature in class file user/R1,
compiling:(/private/var/folders/0k/xj_drd990xxf4q99n2bdknrc0000gn/T/form-init3397614882621384237.clj:1:1)
I'm assuming that defrecord is adding its hashCode and equals
implementations without checking if it's being overridden, but haven't
verified. (That was with 1.7.0-beta3 at least).