Re: Private multimethods possible?

2017-01-12 Thread Andy Fingerhut
At least a few tools built on top of Clojure (not part of the base language implementation) might not work with multiple namespaces defined in the same file. The library tools.namespace, for one, looks for only the first ns form in each source file, and assumes there are no more after that. I do

Re: Private multimethods possible?

2017-01-11 Thread Didier
Maybe you're right in not recommending this, but I find it at first glance to be quite nice. Now, I wouldn't keep switching namespace back and forth, but having two sections in the file, one the public API at the top, and everything else at the bottom in a private namespace, that's quite nice

Re: Private multimethods possible?

2017-01-10 Thread Meikel Brandmeyer (kotarak)
Am Dienstag, 10. Januar 2017 01:19:16 UTC+1 schrieb Didier: > > How would you declare a namespace within a namespace? Or two namespaces in > the same file? > > You can do so quite easily. (ns foo.bar) (defmulti a :dispatch) (defn b [x] (str "Called a. This was the result: " (a

Re: Private multimethods possible?

2017-01-09 Thread Didier
How would you declare a namespace within a namespace? Or two namespaces in the same file? On Friday, 23 October 2009 04:41:13 UTC-7, Meikel Brandmeyer wrote: > > Hi, > > On Oct 23, 8:45 am, Christophe Grand wrote: > > > Other solutions are to use @#'ns/private-var to

Re: Private multimethods possible?

2009-10-23 Thread John Harrop
On Thu, Oct 22, 2009 at 11:11 PM, Alex Osborne a...@meshy.org wrote: 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) I'm having a bad day for

Re: Private multimethods possible?

2009-10-23 Thread Alex Osborne
John Harrop wrote: I think we need some notion of semi-private as well. It would be ignored by :use and by automation like tab-completion of symbols, doc generation, and the like (except it would show in tab-completion inside of its namespace) but would not actually be illegal to invoke

Re: Private multimethods possible?

2009-10-23 Thread Christophe Grand
Hi John, On Fri, Oct 23, 2009 at 8:08 AM, John Harrop jharrop...@gmail.com wrote: I think we need some notion of semi-private as well. It would be ignored by :use and by automation like tab-completion of symbols, doc generation, and the like (except it would show in tab-completion inside of

Re: Private multimethods possible?

2009-10-23 Thread Meikel Brandmeyer
Hi, On Oct 23, 8:45 am, Christophe Grand christo...@cgrand.net wrote: Other solutions are to use @#'ns/private-var to access private vars from the macro or to make the macro shallow using a public (usually higher-order) helper function (is this possible in the general case?). It is not 100%

Private multimethods possible?

2009-10-22 Thread samppi
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. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Private multimethods possible?

2009-10-22 Thread Alex Osborne
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

Re: Private multimethods possible?

2009-10-22 Thread Alex Osborne
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) I'm having a bad day for typos, the example should of course be: (defmulti #^{:private true} my-multi