On Feb 10, 9:45 am, "Stephen C. Gilardi" <squee...@mac.com> wrote:
> 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.
>
I think this needs more clarification as to what is meant by a lib/
root directory. The lib .clj itself is not in this directory, but is
its same-named sibling.
Also, it creates potential overlap between hierarchical namespaces,
e.g. a.b.c and a.b.c.d, where the resources of the former would be
siblings of the root .clj of the latter. Seems confusing at first
glance.
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
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---