I usually work around this by putting the dispatch in a separate def and
referencing the var within defmulti.

(defmulti my-multi #'my-dispatch)

It's barely slower for the extra var dereference and very convenient for
development.

On Fri, Apr 1, 2016 at 12:10 PM hiskennyness <kentil...@gmail.com> wrote:

> I just killed two hours trying to figure out why my tweaks to the dispatch
> function of defmulti did not work. Finally got the feeling I had found a
> bug in Clojure, but then I found a comment somewhere saying it is a
> feature, effectively a defonce (and, yes, looking at the source I see it
> does not do anything if it is already defined).
>
> Shucks, could we get a warning or some doc on this?
>
> But I am a Lisper, I am used to this. The classic is the initform to a
> class-allocated variable in defclass. :)
>
> -kt
>
> --
> 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.
>

-- 
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.

Reply via email to