* feature request: simple hashbang for executable scripts
@ 2017-08-19 9:00 j kalbhenn
2017-08-21 7:04 ` Chaos Eternal
2017-08-23 6:00 ` Mark H Weaver
0 siblings, 2 replies; 5+ messages in thread
From: j kalbhenn @ 2017-08-19 9:00 UTC (permalink / raw)
To: guile-devel
scripts of other languages usually need just one line to specify the interpreter:
#!/usr/bin/myinterpreter
but with guile we have to add a final !#
#!/usr/bin/guile !#
or even
#!/usr/bin/guile -s
!#
in my opinion, this is not ideal. from my perspective as a guile user this seems to be unnecessarily inconsistent and complicated.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: feature request: simple hashbang for executable scripts
2017-08-19 9:00 feature request: simple hashbang for executable scripts j kalbhenn
@ 2017-08-21 7:04 ` Chaos Eternal
2017-08-21 9:21 ` j
2017-08-23 6:00 ` Mark H Weaver
1 sibling, 1 reply; 5+ messages in thread
From: Chaos Eternal @ 2017-08-21 7:04 UTC (permalink / raw)
To: j kalbhenn, guile-devel
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
you can put more arguments in before !#
that is on-purpose.
On Sat, Aug 19, 2017 at 5:01 PM j kalbhenn <jkal@posteo.eu> wrote:
> scripts of other languages usually need just one line to specify the
> interpreter:
>
> #!/usr/bin/myinterpreter
>
> but with guile we have to add a final !#
>
> #!/usr/bin/guile !#
>
> or even
>
> #!/usr/bin/guile -s
> !#
>
> in my opinion, this is not ideal. from my perspective as a guile user this
> seems to be unnecessarily inconsistent and complicated.
>
>
[-- Attachment #2: Type: text/html, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: feature request: simple hashbang for executable scripts
2017-08-21 7:04 ` Chaos Eternal
@ 2017-08-21 9:21 ` j
0 siblings, 0 replies; 5+ messages in thread
From: j @ 2017-08-21 9:21 UTC (permalink / raw)
To: Chaos Eternal; +Cc: guile-devel
that is correct.
i wish there was a way to still use a simple one-line hashbang.
maybe it would be possible to recognise a backslash-escaped newline for
continuing the arguments to the interpreter?
it does not seem like a commonly needed, or even necessary, feature to
support multi-line arguments to interpreter directives in executable
scripts with scsh block comments like this.
by the way, my first example with the !# on the same line does not work.
the !# apparently has to be on the second line.
On 2017-08-21 07:04, Chaos Eternal wrote:
> you can put more arguments in before !#
> that is on-purpose.
>
> On Sat, Aug 19, 2017 at 5:01 PM j kalbhenn <jkal@posteo.eu> wrote:
>
>> scripts of other languages usually need just one line to specify the
>> interpreter:
>>
>> #!/usr/bin/myinterpreter
>>
>> but with guile we have to add a final !#
>>
>> #!/usr/bin/guile !#
>>
>> or even
>>
>> #!/usr/bin/guile -s
>> !#
>>
>> in my opinion, this is not ideal. from my perspective as a guile
>> user this seems to be unnecessarily inconsistent and complicated.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: feature request: simple hashbang for executable scripts
2017-08-19 9:00 feature request: simple hashbang for executable scripts j kalbhenn
2017-08-21 7:04 ` Chaos Eternal
@ 2017-08-23 6:00 ` Mark H Weaver
2017-08-25 1:30 ` Matt Wette
1 sibling, 1 reply; 5+ messages in thread
From: Mark H Weaver @ 2017-08-23 6:00 UTC (permalink / raw)
To: j kalbhenn; +Cc: guile-devel
j kalbhenn <jkal@posteo.eu> writes:
> scripts of other languages usually need just one line to specify the
> interpreter:
>
> #!/usr/bin/myinterpreter
>
> but with guile we have to add a final !#
>
> #!/usr/bin/guile !#
The shebang above does not work, because the "!#" is interpreted by the
kernel as an argument to pass to Guile before the script file name, and
then Guile interprets it as a file to load. Unless "!#" is a file in
the current directory, this will fail, or at least it does for me.
> or even
>
> #!/usr/bin/guile -s
> !#
>
> in my opinion, this is not ideal. from my perspective as a guile user
> this seems to be unnecessarily inconsistent and complicated.
There are advantages to the current approach, but regardless of what our
opinions might be about this, I don't see how we could change this now
without breaking a great many Guile scripts. Since the earliest days of
Guile, "#!" has been comment syntax that terminates with "!#", and many
Guile scripts depend on this.
For example, it is quite common to put a shell script between #! and !#
that ends by running Guile on the same file. It is also quite common to
put "-*- scheme -*-" on the second line to that Emacs will recognize the
type of the file.
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: feature request: simple hashbang for executable scripts
2017-08-23 6:00 ` Mark H Weaver
@ 2017-08-25 1:30 ` Matt Wette
0 siblings, 0 replies; 5+ messages in thread
From: Matt Wette @ 2017-08-25 1:30 UTC (permalink / raw)
To: guile-devel
> For example, it is quite common to put a shell script between #! and !#
> that ends by running Guile on the same file. It is also quite common to
> put "-*- scheme -*-" on the second line to that Emacs will recognize the
> type of the file.
I hadn't thought of this. Pretty cool.
mwette$ cat zzz
#!/bin/sh
echo "hello from shell"
export FOO="custom"
exec guile -s $0
!#
(display "hello from guile\n")
(display "FOO: ")
(display (getenv "FOO"))
(newline)
mwette$ ./zzz
hello from shell
;;; note: source file /private/tmp/./zzz
;;; newer than compiled /Users/mwette/.cache/guile/ccache/2.2-LE-8-3.9/private/tmp/zzz.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /private/tmp/./zzz
;;; compiled /Users/mwette/.cache/guile/ccache/2.2-LE-8-3.9/private/tmp/zzz.go
hello from guile
FOO: custom
mwette$
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-25 1:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-19 9:00 feature request: simple hashbang for executable scripts j kalbhenn
2017-08-21 7:04 ` Chaos Eternal
2017-08-21 9:21 ` j
2017-08-23 6:00 ` Mark H Weaver
2017-08-25 1:30 ` Matt Wette
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).