I came across this when updating the wikibook concepts page, Libraries section, to be correct for current Clojure behavior.

In an early implementation of the code that handles libs, the resource (file) for lib a.b.c was at the path "a/b/c/c.clj" within classpath. At that time it was natural to consider "a/b/c/" as the lib's directory.

Later, the resource for the library a.b.c changed to the path "a/b/ c.clj" and the lib's directory became "a/b/".

I think the lib handling code should be changed such that the directory associated with lib a.b.c is (again) "a/b/c/".

The advantage of this comes into focus most sharply in a ":load" clause within "ns".

Here's the updated example from the wikibook:

        (ns example.ourlib
          (:load "ourlib/add1"
                 "ourlib/otherfunc"
                 "ourlib/morefuncs"))

With the change I'm proposing, this would become:

        (ns example.ourlib
          (:load "add1"
                 "otherfunc"
                 "morefuncs"))

Currently core.clj ends with 3 load calls to load in more pieces of clojure.core that were each big enough to warrant a separate file.

The directory structure in src/clj/clojure is (in part):

        src/clj/clojure/
                core.clj
                core_print.clj
                core_proxy.clj
                genclass.clj

With the proposed change, this would become:

        src/clj/clojure/
                core/
                        core_print.clj
                        core_proxy.clj
                        genclass.clj
                core.clj

or, perhaps removing the "core_" prefixes:

        src/clj/clojure/
                core/
                        print.clj
                        proxy.clj
                        genclass.clj
                core.clj

There is also at least one lib in clojure-contrib that would need to be updated.

I welcome discussion of this proposed change with the goal of entering an issue and providing a patch. In the patch, I would also update the doc string for clojure/require to reflect current Clojure behavior.

Thanks,

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to