'require' doc string out of date?

1 view
Skip to first unread message

Daniel Eklund

unread,
Dec 15, 2008, 10:41:42 PM12/15/08
to Clojure
I've been trying to get 'ns' right. The doc for 'require' tells me
the following about library loading:

"The root resource path
is derived from the root directory path by repeating its last
component
and appending '.clj'. For example, the lib 'x.y.z has root directory
<classpath>/x/y/z; root resource <classpath>/x/y/z/z.clj."

It looks like this this is out of date as per
http://groups.google.com/group/clojure/browse_frm/thread/8618a1d93cbbf8b7/58e3f8e5dfb876c9?lnk=gst&q=aot#58e3f8e5dfb876c9

If my observation is correct, could we update the 'require' doc
string?

many continuing thanks,
daniel

Chouser

unread,
Dec 16, 2008, 10:09:47 AM12/16/08
to clo...@googlegroups.com

You are correct, it should say something like:

A 'lib' is a named set of resources in classpath whose contents define a
library of Clojure code. Lib names are symbols and each lib is associated
with a Clojure namespace and a Java package that share its name. A lib's
name also locates its source file path using Java's package name to
classpath-relative path mapping. All definitions a lib makes should
be in its associated namespace. Other resources in a lib
may be contained in a similarly-named directory.

'require loads a lib by loading its root resource. The root resource path
is derived from the root directory path by appending '.clj'. For
example, the lib 'x.y.z has root resource <classpath>/x/y/z.clj. The root
resource should contain code to create the lib's namespace and load any
additional lib resources.

In general, clojure-contrib is a good place to look to find examples
of properly laid-out libs, as well as generally idiomatic Clojure
code.

--Chouser

Daniel Eklund

unread,
Dec 16, 2008, 10:34:36 AM12/16/08
to Clojure
> In general, clojure-contrib is a good place to look to find examples
> of properly laid-out libs, as well as generally idiomatic Clojure
> code.
>
> --Chouser

Yeah, just recently I've taken to scanning the code in 'webjure' and
'swank' to see how things are done, rather than relying on the APIs.

I never got to downloading 'clojure-contrib' but the more I read the
group, the more it seems like this is where the magic is happening.
Thanks for the recommendation.
Reply all
Reply to author
Forward
0 new messages