* Proposal: allow "guile foo.scm"
@ 2004-11-11 18:26 Andy Wingo
2004-11-12 14:08 ` Greg Troxel
2004-11-12 21:43 ` Neil Jerram
0 siblings, 2 replies; 7+ messages in thread
From: Andy Wingo @ 2004-11-11 18:26 UTC (permalink / raw)
Hey all,
What do you think of allowing guile to be run as "guile foo.scm"? The
proposal is for it to be the same as "guile -s foo.scm". This would
allow the #! sequence to be shorter, e.g.
#! /usr/bin/env guile
!#
...
instead of
#! /bin/sh
exec guile -s $0 "$@"
!#
assuming you want to find `guile' in the path, of course.
Thoughts?
--
Andy Wingo <wingo@pobox.com>
http://ambient.2y.net/wingo/
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Proposal: allow "guile foo.scm"
2004-11-11 18:26 Proposal: allow "guile foo.scm" Andy Wingo
@ 2004-11-12 14:08 ` Greg Troxel
2004-11-12 15:19 ` Paul Jarc
2004-11-12 15:32 ` Jose A. Ortega Ruiz
2004-11-12 21:43 ` Neil Jerram
1 sibling, 2 replies; 7+ messages in thread
From: Greg Troxel @ 2004-11-12 14:08 UTC (permalink / raw)
Cc: guile-devel
What do you think of allowing guile to be run as "guile foo.scm"?
I think it makes sense; /bin/sh acts like this. Reading 'guile
--help', this could currently only start up a guile with foo.scm in
(command-line), but it doesn't.
But, I think your example fails to pass arguments to the guile
process. Do you mean to include $0 $@? Why can't you do
#! /usr/bin/env guile -s $0 "$@"
!#
--
Greg Troxel <gdt@ir.bbn.com>
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Proposal: allow "guile foo.scm"
2004-11-12 14:08 ` Greg Troxel
@ 2004-11-12 15:19 ` Paul Jarc
2004-12-22 16:25 ` Marius Vollmer
2004-11-12 15:32 ` Jose A. Ortega Ruiz
1 sibling, 1 reply; 7+ messages in thread
From: Paul Jarc @ 2004-11-12 15:19 UTC (permalink / raw)
Cc: guile-devel
>> What do you think of allowing guile to be run as "guile foo.scm"?
This has come up before. It may already be in CVS; I don't remember.
Greg Troxel <gdt@ir.bbn.com> wrote:
> But, I think your example fails to pass arguments to the guile
> process.
The kernel supplies the arguments. Try it with "#!/usr/bin/env echo".
> Do you mean to include $0 $@? Why can't you do
>
> #! /usr/bin/env guile -s $0 "$@"
> !#
Only one argument (in this case, "guile") can be included in the #!
line, or else you'll get different behavior on different platforms.
Some would give you a single argument containing 'guile -s $0 "$@"';
some would give you a just "guile"; perhaps there are some that would
give you "guile", "-s", "$0", and '"$@"' as separate arguments. But
none of them will substitute the appropriate values for $0 and $@,
because this line is interpreted by the kernel, not the shell.
paul
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Proposal: allow "guile foo.scm"
2004-11-12 14:08 ` Greg Troxel
2004-11-12 15:19 ` Paul Jarc
@ 2004-11-12 15:32 ` Jose A. Ortega Ruiz
2004-11-12 15:39 ` Paul Jarc
1 sibling, 1 reply; 7+ messages in thread
From: Jose A. Ortega Ruiz @ 2004-11-12 15:32 UTC (permalink / raw)
Greg Troxel <gdt@ir.bbn.com> writes:
> What do you think of allowing guile to be run as "guile foo.scm"?
>
> I think it makes sense; /bin/sh acts like this. Reading 'guile
> --help', this could currently only start up a guile with foo.scm in
> (command-line), but it doesn't.
>
> But, I think your example fails to pass arguments to the guile
> process. Do you mean to include $0 $@? Why can't you do
>
> #! /usr/bin/env guile -s $0 "$@"
> !#
>
IMHO, the best way would be to support SRFI-22 (Running Scheme scripts
in Unix, http://srfi.schemers.org/srfi-22/srfi-22.html), which calls a
procedure named main in the body of a script starting with
#!/usr/bin/env guile
after evaluating the body, passing to it as arguments the provided
command line ones [1]. Besides being a simple approach, it would be make
live easier for people writing code intended for multiple schemes.
Just my .02 euros,
jao
Footnotes:
[1] Actually, i'm oversimplifying here: the SRFI suggests also
concrete names for the interpreter (instead of just 'guile'),
according to its compliance to RnRS.
--
If people do not believe that mathematics is simple, it is only
because they do not realize how complicated life is.
- John von Neumann
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Proposal: allow "guile foo.scm"
2004-11-12 15:32 ` Jose A. Ortega Ruiz
@ 2004-11-12 15:39 ` Paul Jarc
0 siblings, 0 replies; 7+ messages in thread
From: Paul Jarc @ 2004-11-12 15:39 UTC (permalink / raw)
Cc: guile-devel
"Jose A. Ortega Ruiz" <jao@gnu.org> wrote:
> IMHO, the best way would be to support SRFI-22 (Running Scheme scripts
> in Unix, http://srfi.schemers.org/srfi-22/srfi-22.html),
This has also come up before. IIRC, the consensus (or at least one of
the suggestions) was that if this were to be supported at all, it
should be in a separate binary, not guile itself (for backwards
compatibility, and because guile's #!...!# mechanism is more
flexible).
> [1] Actually, i'm oversimplifying here: the SRFI suggests also
> concrete names for the interpreter (instead of just 'guile'),
> according to its compliance to RnRS.
Another reason to make it a separate binary, then.
paul
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Proposal: allow "guile foo.scm"
2004-11-11 18:26 Proposal: allow "guile foo.scm" Andy Wingo
2004-11-12 14:08 ` Greg Troxel
@ 2004-11-12 21:43 ` Neil Jerram
1 sibling, 0 replies; 7+ messages in thread
From: Neil Jerram @ 2004-11-12 21:43 UTC (permalink / raw)
Cc: guile-devel
Andy Wingo wrote:
>Hey all,
>
>What do you think of allowing guile to be run as "guile foo.scm"? The
>proposal is for it to be the same as "guile -s foo.scm". This would
>allow the #! sequence to be shorter, e.g.
>
>#! /usr/bin/env guile
>!#
>...
>
>instead of
>
>#! /bin/sh
>exec guile -s $0 "$@"
>!#
>
>assuming you want to find `guile' in the path, of course.
>
>Thoughts?
>
>
This in already in CVS HEAD (since August 2003), so will be in 1.8 one day.
Neil
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Proposal: allow "guile foo.scm"
2004-11-12 15:19 ` Paul Jarc
@ 2004-12-22 16:25 ` Marius Vollmer
0 siblings, 0 replies; 7+ messages in thread
From: Marius Vollmer @ 2004-12-22 16:25 UTC (permalink / raw)
Cc: guile-devel
prj@po.cwru.edu (Paul Jarc) writes:
>>> What do you think of allowing guile to be run as "guile foo.scm"?
>
> This has come up before. It may already be in CVS; I don't remember.
It is:
2003-08-30 Neil Jerram <neil@ossau.uklinux.net>
* script.c (scm_compile_shell_switches): Make -s switch optional
if file to be loaded does not begin with a `-'. (Thanks to Aaron
VanDevender for the patch!)
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2004-12-22 16:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-11 18:26 Proposal: allow "guile foo.scm" Andy Wingo
2004-11-12 14:08 ` Greg Troxel
2004-11-12 15:19 ` Paul Jarc
2004-12-22 16:25 ` Marius Vollmer
2004-11-12 15:32 ` Jose A. Ortega Ruiz
2004-11-12 15:39 ` Paul Jarc
2004-11-12 21:43 ` Neil Jerram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).