[R6RS] Scripts and toplevel code

Anton van Straaten anton at appsolutions.com
Thu Aug 17 14:33:08 EDT 2006

Kent wrote:
>>#!/usr/bin/env scheme-script
>>(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.
> It's a shame this can't be converted to a library form via a Scheme
> macro.

A proposal for R7RS, to fix the underlying issue here, and restore the 
full power of Scheme macros:

It could be specified that R7RS implementations provide a partial 
expansion tool, which expands any code outside library forms to library 
forms, using a set of (Scheme) macros specified when the tool is run. 
It would be an error for any code to fail to expand to a library form. 
"Dumb" text processing tools (sed et al) could then operate on this 
partially expanded code.


More information about the R6RS mailing list