On Fri, Nov 21, 2008 at 10:46 AM, Stuart Sierra <[EMAIL PROTECTED]> wrote: > > So there's a decision to be made: should Clojure behave more like a > scripting language (invoke by file) or more like Java (invoke by > class)? There are pros and cons either way. Theoretically, it could > support both.
I vote both. A few days ago I typed up something like this in a scratch file: 1. (require 'my.foo) (my.foo/-main "arg1" "arg2") 2. clj my/foo.clj arg1 arg2 3. my/foo.clj arg1 arg2 4. java my.foo arg1 arg2 The idea was that it should be possible to write a single clj file and have all these forms work. Numbers 2 and 3 (and possibly 1) are compiling .clj on the fly. Use case 1 shows the file being used as a library, with its -main function only being run if explicitly requested. 2 implies that when run this way, -main is called automatically with *command-line-args* 3 implies the use of #!/bin/env clj or some such at the top of foo.clj, and again -main would be called automatically 4 shows the use of my.foo after its been compiled to a class file. It would be reasonable for the stand-alone compiler to also provide an option to produce a .jar file directly, allowing a fifth use case: 5. java -jar my-foo.jar arg1 arg2 A cleverly written clj shell-script ought to be able to do all this today, though that doesn't work well as a cross-platform solution. So the question is -- are these use cases generally desirable? They are to me, but am I alone? --Chouser --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---