[R6RS] Scripts and toplevel code

Anton van Straaten anton at appsolutions.com
Mon Aug 14 00:58:03 EDT 2006

Michael Sperber wrote:
> 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.

The lighter-weight syntax is good.

Mike, I think you've mentioned it before, but could you remind me what 
you had in mind for the semantics of code that appears outside 
procedures (i.e. at "top" level) within such a script form?  Would it 
execute before the script entry point is called?  Or would such code be 


More information about the R6RS mailing list