[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
No more required error detection
From: "Sergei Egorov" <esl@xxxxxxxxxxxxxxx>
The part of the question is, basically, whether (NULL-LIST? <atom>)
is allowed to return in a conforming implementation or has to
"signal an error" (in RnRS terms). I do not think that forcing
error detection is always a good thing. In Scheme, (car 5)
doesn't have to *signal* an error, and on some systems under
certain compiler options it may indeed crash the program
(but performance benefits of unchecked car might be significant).
Yikes. Sergei is quite correct. R5RS does not require Scheme programs to
detect an error when, say, the car procedure is applied to 5. Here is the
relevant section of the report:
When speaking of an error situation, this report uses the phrase "an
error is signalled" to indicate that implementations must detect and
report the error. If such wording does not appear in the discussion
of an error, then implementations are not required to detect or
report the error, though they are encouraged to do so. An error
situation that implementations are not required to detect is usually
referred to simply as "an error."
For example, it is an error for a procedure to be passed an argument
that the procedure is not explicitly specified to handle, even though
such domain errors are seldom mentioned in this report.
Implementations may extend a procedure's domain of definition to
include such arguments.
This strikes me as being pretty revolting and incredibly counter to the spirit
of Scheme. However, that's just my opinion, as opposed to the text of the
If CAR is not required to signal an error when passed a bogus argument, then
it is closing the barn door after the horse has fled to require more of
NULL-LIST?. So I'm backing off on requiring it to do so, exactly as R5RS
states and Sergei has suggested.