On Fri, Apr 26, 2013 at 11:58 AM, Steven Degutis <sbdegu...@gmail.com>wrote:

> I found that I want to have multiple multi-methods, but grouped
> together, much like an interface.
>

There's no syntax for grouping multimethods, but wouldn't it be good enough
to put the defmulti forms near one another? Presumably they'll share a
dispatch fn (or some underlying part of their dispatch fns) and maybe a
hierarchy (as in clojure.core/make-hierarchy), which makes it easier to see
that this set of multimethods goes together.

If your concern is making it fool-proof for consumers of your API to
defmethod for all the right multimethods, you can easily do :default
defmethods that provide a clear error message.

Somewhat less easily you could create a macro that expanded into the right
set of defmethod forms. That seems excessive to me, but I don't know your
context.

-- 
-- 
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/groups/opt_out.


Reply via email to