samppi wrote:
> Are private multis possible? I notice that clojure.contrib.def does
> not have a defmulti-, which doesn't bode well, but it's still worth a
> question at the mailing list.

Yes, you can make any symbol private.  If you look at the definition of 
defn- you'll see all it does is set the :private metadata entry on the 
function's name to true:

(defmacro defn-
  "same as defn, yielding non-public def"
  [name & decls]
    (list* `defn (with-meta name (assoc (meta name) :private true)) decls))

This bears repeating as it may not be obious: symbols *themselves* are 
set private, not the functions (or other values) they are bound to.

So you could do the same when defining a multimethod, just give the name 
(symbol) of the method the metadata ":private" with the value "true":

(defmulti #{:private true} my-multi my-dispatch)

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

Reply via email to