> So, the idea is to move the files to some subdirectory, for example,
> clojure/contrib and then be able to evaluate something like
>
> (require 'clojure.contrib.lib)
>
> and that it loads file clojure/contrib/lib.clj based on the classpath.
> Note that this is not imply messing up Clojure namespaces. lib.clj
> could still use "lib" namespace as it does now.
My first choice would have been to add the path to the proposed
directory within the jar file directly to the classpath. I envisioned
using the "!" character to represent entering the jar file as Java
does when it prints URLs for resources within jars:
-cp path/to/jar/file/contrib.jar!clojure/contrib
Looking into that, it appears it's not a supported syntax for a
classpath entry. Does anyone know another way to accomplish something
similar using existing Java methods?
Symbol names containing "/" or "." are handled specially by clojure:
http://clojure.sourceforge.net/reference/reader.html
There's also no easy way to separate out the apparent "components"
between the periods.
The action of the "require" statement you proposed above is supported
now using the ":in" option for the libspec:
(require (lib :in "clojure/contrib"))
It would be feasible to add a concept of a "lib path": one or more
paths which would be automatically appended to each classpath root if
the resource were not found without extending the classpath. If that
would be a significant convenience, I'm open to considering it. We'd
want to weigh the convenience against the added complexity.
Does ":in" provide what you're looking for?
--Steve