On 28/03/2010, at 8:01 PM, B Smith-Mannschott wrote:

> On Sun, Mar 28, 2010 at 08:39, Antony Blakey <antony.bla...@gmail.com> wrote:
>> 
>> On 28/03/2010, at 4:42 PM, Antony Blakey wrote:
>> 
>>> (defproject main "org.clojars.the-kenny:clojure-couchdb:0.2"
>>>  :add-default-plugins true
>>>  :description "Simple Clojure interface to Apache CouchDB, fork of the 
>>> original project with function arguments instead of *server* and some other 
>>> changes."
>>>  :dependencies [["org.clojure:clojure:1.1.0-master-SNAPSHOT"]
>>>                 ["org.clojure:clojure-contrib:1.0-SNAPSHOT"]
>>>                 ["org.clojure:clojure-http-client:1.0.0-SNAPSHOT"]])
>> 
>> Actually, it's even simpler than that because the string-format coordinates 
>> removes the need to wrap the coordinate in a vector:
> 
> True, but concatenating the three coordinates together into a single
> string smells like a [first normal form][1NF] violation to me. I think
> Leiningen's notation is a better fit and more idiomatic as Clojure,
> even if it is a little more verbose to type.

Having completed this now, so I can read leningen files, the problem is that 
the leiningen format needs to be quoted i.e the macro needs to transform

  :dependencies [[a/b "1.0"]] 

into

  :dependencies '[[a/b "1.0"]]

which means that the dependencies list cannot be computed dynamically (well, 
without extra syntax to unquote). It would have been ok if leiningen required 
quoted symbols e.g.

  :dependencies [['a/b "1.0"]]

> - Clojure code manipulating poloyglot's notation is more complex
> because it must be parsed first, and then recombined. Leiningen's
> notation already is 'parsed'.

Parsing is still required in order to deal with the optional nature of the 
group id and version number e.g.

  (defmulti parse-reference class)

  (defmethod parse-reference clojure.lang.Symbol
    [reference]
    (let [artifact (name reference)
          group (if-let [g (namespace reference)] g artifact)]
      {:group-id group :artifact-id artifact}))

  (defmethod parse-reference clojure.lang.PersistentVector
    [reference]
    (let [ga (parse-reference (reference 0))]
      (if (and (> (count reference) 1) (= (class (reference 1)) String))
        (assoc ga :version (reference 1))
        ga)))

So the difference is minor.

> - Editing just the version of a dependency (or the project itself) is
> a fairly common occurrence and is somewhat more awkward if you're
> editing only *part* of a string literal, rather than a single token.

Agreed.

Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Always have a vision. Why spend your life making other people’s dreams?
 -- Orson Welles (1915-1985)

-- 
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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to