Taylan Ulrich Bayırlı/Kammer <xxxxxx@gmail.com> schrieb am Do., 7. Juli 2016 um 01:20 Uhr:
Arne Babenhauserheide <xxxxxx@web.de> writes:

> Hi,
>
> SRFI-138 describes the Chibi and Larceny approaches, but is currently
> missing Guile.
>
> A difference in Guile is that it uses -L to add a directory to the
> library search path.
>
> Also the usual way to run Guile Scheme as a script with shell-deferring
> is to exec the commandline. Here’s an example:
>
> http://www.draketo.de/proj/py2guile/#sec-2-2-3-2-2
>
> Other ways to run Guile scripts are documented in the Scripting-Examples
> of the Guile Reference:
> https://www.gnu.org/software/guile/docs/docs-2.0/guile-ref/Scripting-Examples.html#Scripting-Examples
>
> Best wishes,
> Arne

The SRFI describes the command-line interface of an executable called
"compile-r7rs".  Guile or any other Scheme implementation could detect
when ARGV[0] is that string (so a symlink or hardlink of that name to
the normal guile executable will work) and implement the described CLI.
Or it could provide a separate program implementing that CLI as a
wrapper for guile.

Exactly. The purpose of this SRFI is not to describe the state of art for existing Scheme implementations but to provide one portable interface that is to be implemented (and should be implementable) by the various implementations of the R7RS.

As Taylan points out, implementations have several ways to provide a ‘compile-r7rs’. The simplest way is probably to provide a wrapper script.
 
Chibi and Larceny will have to do the same, although they may just use
their default behavior regardless of the value of ARGV[0], given that
their CLI is already a superset of the CLI described in SRFI 138.

I chose the behaviour of two existing Scheme implementations mainly because I had to start somewhere (and because the library location algorithm of Chibi seems to be well-known and relatively widely supported).

However, I should note that Larceny's CLI is not strictly a superset of this SRFI 138 due to the following reason: Larceny's current library location algorithm searches more files for library definitions, so it will have to implement a mode in which only the files specified by SRFI 138 are being searched.

I also haven't yet checked whether ‘(car (command-line))’ returns the name of the binary when the simple ‘compile-r7rs’ I created for Chibi Scheme is adapted with minimal changes to Larceny.

--

Marc