Hi Chas,
Thanks for looking.
> (a) The docs in lib.clj imply that require should fail if it can't
> load a library (e.g. "ensures that the specified libs are loaded").
> Even if I'm misreading that, shouldn't require fail (or optionally
> fail?) if the libspec cannot be resolved?
You're right. That's a bug: a regression from previous behavior when
I tried to simplify the code that does the loading by using
"loadResourceScript". I'll restore the old behavior today. I asked
Rich to give me some way to know that loadResourceScript failed and
he's OK with that so that should appear at some point.
> (b) What's the correct incantation to get require/use to grab a
> library from a package? I have foo.clj in com/pkg, and none of these
> seem to work: (use com.pkg.foo) (use "com.pkg.foo") (use 'com.pkg.foo)
> (use "com/pkg/foo") (use (symbol "com/pkg/foo")), etc.
The correct incantation is:
(use (foo :in "com/package"))
There are some examples in the documentation at the top of "lib.clj".
' sorry I missed you in #clojure. Thanks for following up here!
--Steve
> The biggest nuisance I can see is when you want to utilize a namespace
> but not "refer" it -- you'll be typing "foo.bar.baz/quux" a lot.
> Could we have namespace aliases? I.e. (refer 'foo.bar.baz :as 'baz),
> then call baz/quux ?
It might be nice to have first class namespaces. You could then "alias"
by simply assigning to a var. Further, you could then do things like
use the 'binding' macro to redirect existing code to use alternative
namespaces.
sRp
I don't see how this would be that much slower, especially since most
people would probably dereference away the other namespace well before
entering performance sensitive loops. For instance:
(def baz (-> foo (:bar) (:baz)))
(defn my-loop [x]
...
(recur (baz x)))
sRp