On Jun 2, 2009, at 8:59 AM, Chouser wrote:
On Tue, Jun 2, 2009 at 7:49 AM, Stephen C. Gilardi <squee...@mac.com> wrote:
On Jun 2, 2009, at 4:45 AM, Konrad Hinsen wrote:

That looks like a perfect candidate for clojure.contrib.repl-utils!

Thanks! After a little more discussion, I'd like to put it in there.

I'm never sure what the etiquette is for adding to other people's files in contrib, but please don't hesitate to add this to repl-utils on my account.

I agree on the etiquette thing. I planned to track you down and ask you. Thanks for the permission! In clojure.contrib.core, Laurent put in a clause at the top giving blanket permission. In that case I marked off a section for my contribs (dissoc-in and new-by-name) so anyone who wants to ask about them can find me.

Any thoughts?

Using gen-class you can have a namespace that is runnable from the Java command line by providing a main() method. This usually defers to a function named "-main" that expects string arguments. From my reading of your 'run', it looks like you're using a function named "main" that expects symbol, string, etc.
args.  I assume this difference is intentional?

It is intentional. I see them as having slightly different roles given the more flexible types that main can see vs. the "just strings" that - main (<prefix>main in the general case) would see. In cases where they can be unified it can be done easily with a small stub, a def, or a clojure.contrib.def/defalias.

I think it would be a cool idea for "ns" to support a ":main" clause that would let you specify the function to run when this namespace is executed using "run". I would default it to "main", but it could be specified as "-main" if that's appropriate or another name with more meaning in general.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to