Hi folks,

I'm working on a Clojure package manager called Capra, and I need some
opinions on the syntax for specifying dependencies. The most basic
system I've come up with is:

  (capra/depend "apache/commons-codec/1.4")
  (ns example
    (:import org.apache.commons.codec.digest.DigestUtils))

  (defn md5 [s]
    (DigestUtils/md5Hex s))

The capra/depend function locates the package denoted by a unique ID,
and then dynamically adds it to the classpath. This syntax assumes
that the user has placed (require 'capra) in their user.clj script.

Another possible syntax is to dynamically insert the capra/depend
function into clojure.core using with-ns from clojure-contrib. This
would allow the depend function to be referenced in the ns
declaration:

  (ns example
    (:depend "apache/commons-codec/1.4")
    (:import org.apache.commons.codec.digest.DigestUtils))

Or perhaps:

  (ns example
    (:capra "apache/commons-codec/1.4")
    (:import org.apache.commons.codec.digest.DigestUtils))

The disadvantage of this approach is that I'm not sure I like the idea
of adding anything to clojure.core.

Another approach is to suggest a patch for Clojure, which would allow
ns to use functions from other namespaces, for example:

  (ns example
    (:capra/depend "apache/commons-codec/1.4")
    (:import org.apache.commons.codec.digest.DigestUtils))

But I'm not sure whether this isn't giving the ns macro too much
functionality.

Does anyone else have any other suggestions on the best syntax for
specifying Jar dependencies in a Clojure file?

- James
--~--~---------~--~----~------------~-------~--~----~
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to