(import (rnrs)) ;R6RS
(import (rnrs programs)) ;R6RS
(import (scheme process-context)) ;R7RS
Exits the running program and communicates an exit value to the operating
system. If no argument is supplied, the exit procedure should
communicate to the operating system that the program exited normally. If an
argument is supplied, the exit procedure should translate the argument
into an appropriate exit value for the operating system.
If obj is #f, the exit is assumed to be
abnormal.
- R7RS
- Runs all outstanding dynamic-wind after procedures, terminates the
running program, and communicates an exit value to the operating system.
In R7RS, (exit #t) is the same as (exit).
- The exit procedure must not signal an exception or return to its
continuation. Because of the requirement to run handlers, this procedure
is not just the operating system's exit procedure.
Most implementations return obj immediately to the operating system if it
is a number between 0 and 255.
- GNU Guile, Chez Scheme
- These implementations run the dynamic-wind after procedures.
This procedure does not return.
This procedure should be avoided in libraries. Applications mainly use it to
return errors to the operating system, indicating to the shell that the
command has failed to execute correctly or indicating to the init system that
the service has failed.
R6RS does not explicitly say that the dynamic-wind exit handlers should run.
Some implementations run them and some do not.
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
- The wrong number of arguments was passed.
- R7RS
- The assertions described above are errors. Implementations may signal an
error, extend the procedure's domain of definition to include such
arguments, or fail catastrophically.
emergency-exit(3scm), exit(3), dynamic-wind(3scm)
This procedure first appeared in R6RS and later appeared in R7RS as well.
MacLISP had a quit function with similar functionality.