[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Formal Comment: (exit #t) should be the same as (exit)

On Wed, Mar 28, 2012 at 2:49 PM, Alan Watson <alan@x> wrote:
Formal Comment

Submitter's Name:           Alan Watson
Submitter's Email Address:  alan@x
Draft Version of Report:    6
Section of draft R7RS:      6.13.4 System interface

The draft R7RS follows the R6RS in specifying that (exit) is a
normal exit, specifying that (exit #f) is an abnormal exit, and
leaving the interpretation of arguments other than #f to the

I suggest that the R7RS should specify that (exit #t) is identical
to (exit). (Perhaps it would be clearer to state that (exit #t) is
a normal exit and (exit) is identical to (exit #t)).

Should it perhaps be similar to what is defined in section 6.3 (i.e. similar to if's <Test>)?

Of all the Scheme values, only #f counts as false in condi-
tional expressions. All other Scheme values, including #t,
count as true

and leave it as implementation defined if the value passed to exit is actually returned
to the OS/system below Scheme.

I think this might get hairy, but it was the first thing to come to mind upon reading Mr. Watson's comment.

This allows the exit status to be handled more uniformly by code
which might exit normally or abnormally. For example, in a compiler
it is often useful to continue after a syntax error, but in this
case one still wants to indicate an abnormal exit. If (exit #t) is
specified as above, one simply has to keep track of whether an error
has occurred in a boolean variable and then:

 (exit (not error-occurred))

rather than the more cumbersome:

 (if error-occurred
   (exit #f)

Scheme-reports mailing list

Q. How many Prolog programmers does it take to change a lightbulb?
A. No.
Scheme-reports mailing list