[R6RS] Scripts and toplevel code

dyb at cs.indiana.edu dyb at cs.indiana.edu
Wed Aug 16 19:34:39 EDT 2006


> My reason for suggesting it is that I'm concerned about having code 
> that's completely anonymous.  Will R6RS then specify procedures for 
> loading and running scripts?  If not, that would seem to be a hole in 
> the spec.  Leveraging the existing mechanism for accessing libraries 
> seems like one of the simplest and most consistent ways to deal with the 
> issue.

R6RS presumably won't specify any mechanism for starting up a Scheme
session, so I don't see why it's any bigger hole not to have a mechansim
for loading and running a script.  But if we do specify a mechanism to
load and run a script, it's no easier with the script form than without.

> If the script form were treated as a library, then the named entry point 
>   would be its sole export, which would allow other libraries to control 
> the script.

Not really, because of the body code that's executed when the script being
treated as a library is invoked.

> Of course, an alternative in this context would be to have 
> scripts export all their top-level definitions.

To me, this is an issue of the interactive environment, and we shouldn't
be designing the syntax of scripts around that.  An interactive
environment can handle whatever we settle upon.  We should focus on what
makes scripts most useful as scripts and thereby encourages the most
users.

> Two advantages of using a 'script' form would be the ability to name and 
> therefore reuse scripts in a standard way, without introducing new 
> mechanisms for locating and loading code; and the ability to include 
> other libraries in the same file as a script, without encountering the 
> ambiguities which you raised in an earlier message.

At one point, Matthew was opposed to having multiple libraries in one
file, and I think it's best if we don't force the issue one way or another
by defining a syntax in which multiple libraries are possible.  In any
case, the script form doesn't address the confusing evaluation order issue
unless the library forms appear before the script form.

Kent



More information about the R6RS mailing list