Re: Method dispatch on class - ns-* functions accepting symbols

2008-09-12 Thread Rich Hickey
On Sep 11, 11:33 am, Stephen C. Gilardi [EMAIL PROTECTED] wrote: On Sep 11, 2008, at 8:12 AM, Rich Hickey wrote: Using the latest syntax is good, although the idiom for static calls is (Classname/method args). For instance: (clojure.lang.Namespace/find sym) instead of: (.find

Re: Method dispatch on class - ns-* functions accepting symbols

2008-09-11 Thread Rich Hickey
On Sep 10, 10:59 pm, Stephen C. Gilardi [EMAIL PROTECTED] wrote: On Sep 10, 2008, at 2:08 PM, Rich Hickey wrote: It would work, but it seems like overkill. In particular, there's no intention to extend it any further, and all symbol versions do the same thing, call find-ns and delegate,

Re: Method dispatch on class - ns-* functions accepting symbols

2008-09-11 Thread Stephen C. Gilardi
On Sep 11, 2008, at 8:12 AM, Rich Hickey wrote:Using the latest syntax is good, although the idiom for static callsis (Classname/method args). For instance:(clojure.lang.Namespace/find sym)instead of:(.find clojure.lang.Namespace sym)because static methods really aren't functions taking classes,

Re: Method dispatch on class - ns-* functions accepting symbols

2008-09-10 Thread Rich Hickey
On Sep 9, 8:17 pm, Stephen C. Gilardi [EMAIL PROTECTED] wrote: Rich mentioned a desire for the ns-* functions to accept either a symbol or a namespace for arguments where they currently accept a namespace. Using a multimethod that dispatches on the class of that argument is one way to do

Re: Method dispatch on class - ns-* functions accepting symbols

2008-09-10 Thread Stephen C. Gilardi
On Sep 10, 2008, at 2:08 PM, Rich Hickey wrote:It would work, but it seems like overkill. In particular, there's nointention to extend it any further, and all symbol versions do thesame thing, call find-ns and delegate, so maybe just adding a letlevel to the existing fns is best:(let [ns (the-ns

Method dispatch on class - ns-* functions accepting symbols

2008-09-09 Thread Stephen C. Gilardi
Rich mentioned a desire for the ns-* functions to accept either a symbol or a namespace for arguments where they currently accept a namespace. Using a multimethod that dispatches on the class of that argument is one way to do that. Here's an example: (defmulti ns-aliases class)