Hi, Am 18.04.2009 um 14:34 schrieb Stephen C. Gilardi:
java -cp .. clojure.main -E my.ns/main my-script-defining-my-ns.cljI'm trying to make this kind of command line easier to use and explain. We basically already have what you're proposing:java -cp .. clojure.main -i my-script-defining-my-ns.clj -e "(my.ns/ main *command-line-args*)"
I tried to make this work with hashdot, but then the script is read twice
because I have to specify it as -i script and it will be passed again as additional parameter to clojure.main. The problem is, that -e works before reading the script and but hashdot doesn't provide a hashdot.args.post. Then I could construct a header like: #! /usr/bin/env hashdot ;;.hashdot.main = clojure.main ;;.hashdot.args.pre = -i ;;.hashdot.args.post = -e "(my.ns/main)"Just the usual great-tools-but-still-not-perfect issue. This could be either "fixed" in hashdot or clojure.main. So it's not a problem of either. It's mine
wanting to combine the two tools...
I still like mine, but an alternative of specifying the function directly and then calling it with the rest of the args as strings and returning the int it returns would also be succinct and perhaps even clearer:java -cp .. clojure.main my.ns/main
Now, that would be cool. Although it would still rule out hashdot, since this passes the script on as additional argument. Could I convince you to have an optional -E to allow the use of tools like hashdot?
I'd rather have it in classpath. What is the "double book-keeping of require..."
(ns foo.bar) (in-ns 'user) (require 'foo.bar) This loads foo.bar again, although it already exists and I did not specify the :reload argument. I ran into this some while ago with a gen-class'd Class. It was I somewhat convoluted setup which I don't remember any more, but it took me some time to figure out, that require doesn't care for all-ns and keeps its own set of namespaces. This I would call double book-keeping.
Thanks very much.
Thanks for your great contributions, Stephen. In particular the require/use system and clojure.main. :) Sincerely Meikel
smime.p7s
Description: S/MIME cryptographic signature