This is a tricky area and one that has seen changes lately - what version of Clojure are you using?
On Friday, September 11, 2015 at 10:42:32 PM UTC-5, Gregg Reynolds wrote: > > Here's something a little perplexing that I discovered by trial and error: > if you reload (using require :reload) a clj file containing a deftype > implementing clojure interfaces (e.g. ISeq, etc.) plus some functions, the > functions will be reloaded but not the deftype implementation code. That > is, the clj file will be reloaded, but changes in the deftype > implementation code will not take effect. > > But if you use gen-interface (in another file, aot-compiled) to create > your interface using your own namespace, and then list that custom > interface (rather than the clojure interfaces) in the deftype, then the > implementation code gets reloaded. I don't really see why this is so, and > haven't found any relevant documentation. Can anybody explain what's > happening behind the curtain? > > Note: I'm running this on the Gooble AppEngine dev server, but I shouldn't > think that makes any difference. > > Thanks, > > -Gregg > > Example: > > A. This does not support code reloading for the deftype implementation > code: > > ;; in foo/bar.clj: > (ns foo.bar...) > ... other functions... > (deftype baz > clojure.lang.Seq > (first [_] ...) > (next [_] ...) > ....) > > > B. This does support reloading of the detype: > > ;; in some/other/namespace.clj: > (ns some.other.namespace ...) > (gen-interface :name foo.bar.Baz > :extends [clojure.lang.Seq ...] > ...) > > ;; in foo/bar.clj: > (ns foo.bar ...) > ... other functions ... > (deftype baz > foo.bar.Baz > ... implementations as before ... > ) > -- 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 --- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.