[R6RS] Programs & scripts

Anton van Straaten anton at appsolutions.com
Mon Nov 27 00:46:58 EST 2006

I've created a modest straw man for your bashing amusement.  I'll flesh 
it out if we can reach some rough agreement in principle about it, or 
parts of it.

This proposal would address, in varying degrees, the following three 
formal comments:

   #51 - Conflating programs and scripts
   #105 - Scheme is not a scripting language
   #106 - "#! /usr/bin/env" is not "portable." It's Unix-specific.

An important related comment is #39, "Script-body differences".  #38, 
"Position-significance of declarations in scripts", is also relevant, 
although perhaps less controversial.

The proposal mainly involves refactoring and clarification of what's 
currently in the report, but it does introduces a new concept of Scheme 
"program" which may be controversial.

Proposal for "programs" and "scripts"

The following changes would be made to the draft:

1. In the "Description of the language" part of the draft:

    a. Replace sections 1.11 and 7, which relate to "Scripts", with
       sections that define Scheme "programs".

    b. Remove any references to the script header and the "scheme-script"
       interpreter (these are addressed in point 2 below).

    c. Replace all mentions of "script" with "program".

    d. Possibly include a rationale for "programs".  With the "script"
       aspect factored out, the remaining rationale for programs is that
       they provide:

        i. A more relaxed format for Scheme code, comparable to the R5RS
           top level, but better-defined.  However, this seemed to be a
           controversial point amongst the editors, and is also the
           subject of formal comment #39, "Script-body differences".
           Needs discussion.

       ii. A way to specify an entry point into a body of Scheme code
           (which happens to work in conjunction with

    The definition of a "program" is an open question.  One possibility
    is to leave it as identical to a 5.91 script, but without the
    requirement that the first line be ignored (addressed in point 2).

2. In an appendix or other auxiliary location:

    a. Specify how a Unix-style script relates to a Scheme program.
       Specify a "script" as a file (or some generalization thereof)
       which contains an optional script header (e.g. beginning with
       "#! " or "#!/" [see footnote]), and is followed by a Scheme

    b. Specify the semantics of the "scheme-script" interpreter, which
       would only be mentioned in this appendix.  The interpreter must
       ignore any script header and initiate the execution of the
       remaining R6RS "program".

    c. Possibly say something specific (but short) about other major
       operating systems, in the interests of balance.  Possibly
       provide a rationale for the focus on Unix-like scripts.

    d. Possibly specify that implementations can omit a script
       interpreter in cases where they don't make sense, such as
       implementations targeting embedded platforms, or implementations
       such as Stalin.

    e. Specify a rationale for the inclusion of the above details in the

[Footnote] Mike raised a concern about detecting a script header by its 
first 3 characters in:
We need to agree on the appopriate approach here.


More information about the R6RS mailing list