> I'd really think twice before requiring your users to insert matching pairs of mutation in their code. It goes against the grain of clojure and is error-prone. > Why can’t on-jsload (is that figwheel's?) just run the update within a (binding [*warn-on-overwrite* false] ...)?
The (simplified) structure of the Figwheel reload code is (do (before-jsload) (figwheel-reloads-code) (on-jsload)) I would prefer to use binding, but Figwheel doesn’t run it’s reload within the scope of my before-jsload function, so binding and with-redefs wouldn’t work here. I’m not in love with the matching mutations, but I’m not sure if there’s a better option? A PR to Figwheel is always possible, but this is a fairly niche requirement, so I’m hesitant to add more configuration to it. On Tue, Oct 18, 2016 at 11:15 AM Herwig Hochleitner <hhochleit...@gmail.com> wrote: > In clojure, set! can only be used on dynamic vars, that are currently > bound. > Apparently, clojurescript allows set! on root-bound vars, but I wouldn't > rely on that. > Your use case with matching set! pairs really has the semantics of just > calling def. > A much safer way to temporarily alter the root binding of a var (though > still prone to concurrency bugs), is with-redefs. > > I'd really think twice before requiring your users to insert matching > pairs of mutation in their code. It goes against the grain of clojure and > is error-prone. > Why can't on-jsload (is that figwheel's?) just run the update within a > (binding [*warn-on-overwrite* false] ...)? > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at https://groups.google.com/group/clojurescript. > -- Daniel -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.