Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Adding an option to clojure.main
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Phil Hagelberg  
View profile  
 More options Apr 24 2010, 1:40 am
From: Phil Hagelberg <p...@hagelb.org>
Date: Fri, 23 Apr 2010 22:40:25 -0700
Local: Sat, Apr 24 2010 1:40 am
Subject: Adding an option to clojure.main
So it seems like recently the only thing I use AOT for is producing
-main functions that can be easily run from the command-line. I've
found that an alternate to this is to use clojure.main -e, require the
necessary namespace, and then call (apply -main *command-line-args*),
but this is rather awkward. I wonder if it would be convenient to have
clojure.main take another argument that would accept the name of a
namespace to look for a -main function in.

Thoughts? Would others use this?

-Phil

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen C. Gilardi  
View profile  
 More options Apr 24 2010, 3:17 am
From: "Stephen C. Gilardi" <squee...@mac.com>
Date: Sat, 24 Apr 2010 03:17:34 -0400
Local: Sat, Apr 24 2010 3:17 am
Subject: Re: Adding an option to clojure.main

On Apr 24, 2010, at 1:40 AM, Phil Hagelberg wrote:

> So it seems like recently the only thing I use AOT for is producing
> -main functions that can be easily run from the command-line. I've
> found that an alternate to this is to use clojure.main -e, require the
> necessary namespace, and then call (apply -main *command-line-args*),
> but this is rather awkward. I wonder if it would be convenient to have
> clojure.main take another argument that would accept the name of a
> namespace to look for a -main function in.

> Thoughts? Would others use this?

I like it a lot.

Here's an old discussion along similar lines.

        http://www.mail-archive.com/clojure@googlegroups.com/msg12372.html

I think something like this would be a nice improvement to clojure.main.

--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
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Osborne  
View profile  
 More options Apr 24 2010, 3:33 am
From: Alex Osborne <a...@meshy.org>
Date: Sat, 24 Apr 2010 17:33:55 +1000
Local: Sat, Apr 24 2010 3:33 am
Subject: Re: Adding an option to clojure.main

Phil Hagelberg <p...@hagelb.org> writes:
> So it seems like recently the only thing I use AOT for is producing
> -main functions that can be easily run from the command-line. I've
> found that an alternate to this is to use clojure.main -e, require the
> necessary namespace, and then call (apply -main *command-line-args*),
> but this is rather awkward. I wonder if it would be convenient to have
> clojure.main take another argument that would accept the name of a
> namespace to look for a -main function in.

> Thoughts? Would others use this?

I agree that this would be an excellent addition and would improve
usability.  I use clojure.main -e "(use 'foo)(-main)" all the time as
well but it's probably pretty baffling to new users as to how they are
actually supposed to run their programs outside of an IDE.

Just putting code at the top-level is not suitable as it will be run
whenever the namespace is loaded -- which is not what you want when
compiling or generating documentation.  Some languages do this like
Python's "if __name__ == '__main__': main(*sys.argv)"
boilerplate, but this is ugly and unnecessarily repetitive as they
almost always just call main() anyway.

Virtually every program larger than a trivial script is going to have a
main function of some sort, so I think languages should really take it
into account directly.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Phil Hagelberg  
View profile  
 More options Apr 24 2010, 12:06 pm
From: Phil Hagelberg <p...@hagelb.org>
Date: Sat, 24 Apr 2010 09:06:09 -0700
Local: Sat, Apr 24 2010 12:06 pm
Subject: Re: Adding an option to clojure.main
On Sat, Apr 24, 2010 at 12:17 AM, Stephen C. Gilardi <squee...@mac.com> wrote:

> I like it a lot.
> Here's an old discussion along similar lines.
> http://www.mail-archive.com/clojure@googlegroups.com/msg12372.html
> I think something like this would be a nice improvement to clojure.main.

Cool. It's an interesting idea to have a customizable function in the
ns form, but having it hardcoded to -main solves the 80% case and can
be done in seven lines, so maybe we can get this in and then expand
upon it later if needed.

Ticket created:
http://www.assembla.com/spaces/clojure/tickets/315-add-support-for-ru...

-Phil

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »