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, so maybe just adding a let
> > level to the existing fns is best:
>
> > (let [ns (the-ns ns)] ...)
>
> > where the-ns x is just (if (instance? Namespace x) x (find-ns x))
>
> That looks good. Thanks for the advice. I adopted it in the enclosed
> patch.
>
> These are the changes it makes to boot.clj:
>
>         add private the-ns
>         change to allow namespace arguments to be either a namespace or a
> symbol in ns-*
>         change to lispy syntax for java calls in ns-* and find-ns, create-ns,
> remove-ns, all-ns
>
> I made the last change for consistency and brevity--moving to the more
> modern syntax while I was in this code. I can give you a patch that
> excludes that change if you prefer.
>

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 clojure.lang.Namespace sym)

because static methods really aren't functions taking classes, but
functions in a class namespace.

> I've tested all the modified functions and worked with the new
> behavior a little. Using these functions feels more flexible after the
> change. Please consider adopting this patch.
>

I think it's close. The other tip I have is that by type-hinting the-
ns you can avoid the hint in every let:

(defn #^{:private true :tag clojure.lang.Namespace}
  the-ns ...)

(defn ns-name
  "Returns the name of the namespace, a symbol."
  [ns]
  (let [ns (the-ns ns)]
    (.getName ns)))

getName is a non-reflective call.

If you could make these changes I'll incorporate the patch, thanks!

Rich
--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to