[R6RS] Scripts and toplevel code
dyb at cs.indiana.edu
dyb at cs.indiana.edu
Wed Aug 16 17:17:59 EDT 2006
> #!/usr/bin/env scheme-script
> #!r6rs
> (script <script name> <entry point name>
> (import ...)
> <library body>)
This is less verbose, but the <script name> is noise, and I object to
including it just to support one implementation's debugging model.
Also, I think that requiring an entry point to be defined is strictly less
useful than not requiring one to be defined. One can always establish a
convention whereby a main routine is defined, then invoked in the last
line of the script. It then becomes trivial to debug in the manner Mike
wants to do by adding a library header and commenting out the last line.
It would even be possible to define a load-script procedure that does so
automatically.
On the other hand, forcing programmers to define an entry point will not
force them to avoid starting the script execution in the library body. In
fact, if they don't look at command-line arguments, they may just do all
of the execution in the library body and define the entry point to do
nothing. In any case, execution may in fact start even earlier, in the
bodies of imported libraries. Mike's model does not allow such scripts to
be debugged any more easily than ones using the more lightweight syntax I
have proposed.
> Finally, in my quest to support relaxed scripts, one other thing I think
> could be useful is to allow omission of the entry point, so that a
> script would not be required to define an entry procedure, but could
> just rely on code at the top level of the script form. Again, this
> increases user choice: someone wanting more rigor can specify and define
> an entry procedure.
This would help, but I think it's better to go with the lightweight syntax
and estalish conventions for anything more structured.
Kent
More information about the R6RS
mailing list