[R6RS] Scripts and toplevel code

Matthew Flatt mflatt at cs.utah.edu
Fri Aug 18 00:22:37 EDT 2006

At Thu, 17 Aug 2006 14:33:08 -0400, Anton van Straaten wrote:
> Kent wrote:
> >>#!/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.
> > 
> > 
> > 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.

Do you mean to attach an initial "language" to the code, expand the
language spec plus code to a `library' form with a fixed body syntax,
and then have tools process only expanded code? In that case, you need
a reliable way to specify languages, but maybe the library system
itself could help with that. In any case, it sounds plausible to me. :)


More information about the R6RS mailing list