[R6RS] Scripts and toplevel code

Michael Sperber sperber at informatik.uni-tuebingen.de
Sun Aug 13 04:10:05 EDT 2006


Anton van Straaten <anton at appsolutions.com> writes:

> One of the traditional benefits of Scheme has been a kind of
> scalability along the dimension of source-code rigor: a program can
> start out as an experiment in the REPL, progress perhaps via cut &
> paste to becoming a relaxed script, with little structure, and later
> evolve into a more rigorously structured program.  This allows
> programs to evolve "from scripts to programs" (a catchphrase used
> repeatedly by the PLT group, in a slightly different but closely
> related context).  This property of Scheme is worth preserving, and
> worth addressing in the R6RS.

But it seems that adding your proposal to the existing mix will make
that quite hard, as the script can't evolve gracefully into a library:
the forms in its body have to be re-arranged or augmented by "(define
dummy-xxx ...)" , giving scripts bad continuity characteristics.

To my mind, this makes it worth reconsidering the restriction on
library bodies.  This would enable us to say:

#!/usr/bin/env scheme-script
#!r6rs
(script <identifier>
  (import ...)
  <library body>)

where <identifier> names the entry point.  Change it into a library by
changing "script" to "library", replacing <identifier> with the name
of the library and adding an export clause.  This can be done with an
editor macro.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla



More information about the R6RS mailing list