[R6RS] Scripts

dyb at cs.indiana.edu dyb at cs.indiana.edu
Tue Jul 11 12:16:22 EDT 2006

> <script prelude> --> #!/usr/bin/env scheme <line break> #!r6rs

I prefer the following:

  <script prelude> --> #!/usr/bin/env scheme-script <line break> #!r6rs

Rationale: Implementors may wish to use the "scheme" for some other
purpose, like starting up an interactive session, running a non-script
program, or opening up a file in an IDE editor.  We should standardize
on a more specific name, like scheme-script, that clearly narrows
the purpose.

> The library defined by <library form> would have to define a library
> with a fixed name, like (r6rs script), which has to export a procedure
> called `main' as in SRFI 22.

I prefer the following:

  <library form> can define any library it pleases, with or without
  exports, and the library is executed as usual.  The following procedure
  is provided in a script library:

  (command-line) => nonempty list of strings representing the command
                    line; first is the executable name, remainder are
                    command-line arguments

  If the library's execution terminates without raising an exception, the
  script exits with a success status (e.g., EX_OK in sysexits.h).

  If the library raises an uncaught exception with condition &script and
  supplies a &status condition type whose value is a valid exit status,
  the script exits with that exit status.

  If the library raises any other uncaught exception, the script exits
  with an error exit status (e.g., EX_SOFTWARE in sysexits.h).

Rationale: This alternative allows us to avoid dictating the name of the
script module or its exports, which we don't do anywhere else in the
language.  It also gives a script a way to specify its exit status even
if an error occurs before the main routine is invoked, i.e., during the
evaluation of the library's top-level variable definitions and


More information about the R6RS mailing list