On Thu, Nov 06, 2008 at 01:48:43PM -0500, Stuart Halloway wrote:
> 
> Hi all,
> 
> I am playing around with using Clojure to control Ant, something along  
> the lines of Groovy's Gant. I don't know how far I will take this-- 
> right now it is serving as a code example for the book.
> 
> Two questions:
> 
> (1) Anybody interested in seeing lancet carried forward into a real  
> project?

Oh yes please! I had started playing around with something like this, got
far enough to compile some Java source (a static base for some Clojure code
of course), and haven't really touched it sense.

> (2) Below is an example of lancet syntax (compare with Clojure's own  
> build.xml). Any big likes/dislikes?

I've never liked XML DSLs because they lack standard general purpose
language features and go on to invent their own ad-hoc versions.

Is a property not just a 'def' ?

Is a target not a just function? (which only performs its actions if needed)

Isn't a project just a mapping from target names to functions, and dynamic
bindings during the build process?


; properties
(def src "src")
(def jsrc (str src "/jvm"))
(def cljsrc (str src "/clj"))
(def target "classes")
(def clojure.jar "clojure.jar")
(def bootclj (str cljsrc "/clojure/boot.clj"))

; deftarget is like defn but takes no args, and wraps the body in machinery
; that will only call it once per session.

(deftarget clean
  "Remove autogenerated files and directories"
  (delete :dir target))

(deftarget init
  (tstamp)
  (mkdir :dir target))

(deftarget compile-java
  "Compile java sources"  
  (init)
  (javac :srcdir jsrc :destdir target
         :includejavaruntime true
         :debug true
         :target "1.5"))


A project could be defined explicitly, or could be created through
reflection (deftarget would also add some metadata in that case)

This syntax seems Clojurish rather than happens-to-be-on-Clojure. I think it
shows off both the cognitive simplicity of FP and the powerful incremental
nature of a Lisp based internal DSL.


Regards,
Steve

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to