Problem with loading protocols dynamically from checkouts
Hi everyone, I have a mutli-project set-up using Leiningen checkouts. I have a protocols project where I store all my needed protocols and another project depends on this project. I linked the project folder to the checkout folder of the project that depends on the protocols. However, when I change a protocol in the protocols project, I have to call a lein install, re-start REPL to see the effects of this in the dependent project. As far as I understood, Protocols are dynamically built and, therefore, I don't need to restart and reload it. Do you have any idea what I might be doing wrong? Or is this an expected behavior and I'm missing something? Thanks in advance. Regards, Timur -- 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.
Re: Problem with loading protocols dynamically from checkouts
Reloading a protocol definition invalidates any instances of objects which implement the protocol. This may be the problem you are seeing. After reloading a protocol definition, you must also reload any code with `deftype`, `defrecord`, or `reify` which implements the protocol, THEN re-evaluate any code which creates instances of those types. For more discussion of this issue, see the tools.namespace docs under Warnings for Protocols: https://github.com/clojure/tools.namespace#warnings-for-protocols –S On Tuesday, June 9, 2015 at 6:42:31 AM UTC-4, Timur wrote: Hi everyone, I have a mutli-project set-up using Leiningen checkouts. I have a protocols project where I store all my needed protocols and another project depends on this project. I linked the project folder to the checkout folder of the project that depends on the protocols. However, when I change a protocol in the protocols project, I have to call a lein install, re-start REPL to see the effects of this in the dependent project. As far as I understood, Protocols are dynamically built and, therefore, I don't need to restart and reload it. Do you have any idea what I might be doing wrong? Or is this an expected behavior and I'm missing something? Thanks in advance. Regards, Timur -- 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.
Re: Problem with loading protocols dynamically from checkouts
Thanks for the answer Stuart. I was receiving an error when I reload deftype, the error was saying that I cannot define a method of a protocol which is not defined in the protocol although I could even see the method in the protocol map. I just discovered the error: I forgot the :aot field referring to this specific namespace in my lein configuration and as far as I understood the aot compiled classes in the local maven cache have priority, therefore, it needed me to do a lein install each time. Regards, Timur On Tuesday, June 9, 2015 at 2:10:59 PM UTC+2, Stuart Sierra wrote: Reloading a protocol definition invalidates any instances of objects which implement the protocol. This may be the problem you are seeing. After reloading a protocol definition, you must also reload any code with `deftype`, `defrecord`, or `reify` which implements the protocol, THEN re-evaluate any code which creates instances of those types. For more discussion of this issue, see the tools.namespace docs under Warnings for Protocols: https://github.com/clojure/tools.namespace#warnings-for-protocols –S On Tuesday, June 9, 2015 at 6:42:31 AM UTC-4, Timur wrote: Hi everyone, I have a mutli-project set-up using Leiningen checkouts. I have a protocols project where I store all my needed protocols and another project depends on this project. I linked the project folder to the checkout folder of the project that depends on the protocols. However, when I change a protocol in the protocols project, I have to call a lein install, re-start REPL to see the effects of this in the dependent project. As far as I understood, Protocols are dynamically built and, therefore, I don't need to restart and reload it. Do you have any idea what I might be doing wrong? Or is this an expected behavior and I'm missing something? Thanks in advance. Regards, Timur -- 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.