Library's requirements and namespace name

1 view
Skip to first unread message

samppi

unread,
Jan 1, 2009, 9:31:33 PM1/1/09
to Clojure
Let's say that I have a parser library--let's call it FnParse--that I
want to share with the world and let others use. If it requires
another library, say, clojure.contrib.test-is, is there a way for me
to indicate that that library is required? Or is the only thing I may
do is indicate it in the library's documentation?

Also, how should I create a name for the library's namespace? Is the
clojure top-level domain reserved for clojure.core and
clojure.contrib? Can I use something like "clojure.fnparse"? Or should
I follow the Java package conventions and name it
"name.smith.bob.fnparse" (after my .name domain, the only domain I
have)?

Stephen C. Gilardi

unread,
Jan 1, 2009, 9:56:38 PM1/1/09
to clo...@googlegroups.com

On Jan 1, 2009, at 9:31 PM, samppi wrote:

> Let's say that I have a parser library--let's call it FnParse--that I
> want to share with the world and let others use. If it requires
> another library, say, clojure.contrib.test-is, is there a way for me
> to indicate that that library is required? Or is the only thing I may
> do is indicate it in the library's documentation?

Your library source file should begin with an "ns" form that indicates
its dependencies via ":require" and/or ":use" clauses. For example:

(ns clojure.contrib.sql
(:use clojure.contrib.except
clojure.contrib.sql.internal))

> Also, how should I create a name for the library's namespace? Is the
> clojure top-level domain reserved for clojure.core and
> clojure.contrib? Can I use something like "clojure.fnparse"? Or should
> I follow the Java package conventions and name it
> "name.smith.bob.fnparse" (after my .name domain, the only domain I
> have)?

Following Java's convention is one good choice. I recommend treating
the clojure top level "domain" as reserved.

--Steve

Reply all
Reply to author
Forward
0 new messages