restore (debug-level 2)
behavior, but reduce its guarantees
#834
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When
debug-level
is 2 or more, optimization is supposed to refrain from moving a call to an error function into tail position of the enclosing function. (That's a stronger guarantee than the usual one of not moving an expression into tail position if there's potentially a way to detect the movement through continuation marks.) An earlier commit 6a73b9e strengthened movement of error calls in a way that did not preserve this(debug-level 2)
constraint, so this commit primarily adjusts those changes. Also, the earlier commit 19af32e allowed the compiler to move an error call out of tail position, and that transformation is now suppressed whendebug-level
is 2 or more.These changes are meant to help with debugging, but they're not enough to implement the previously specified behavior of
debug-level
. It turns out that Chez Scheme v9.x didn't implement the specified behavior, either, because it would convert(let ([x (error ...)]) x)
to just(error ...)
, for example. The old specification seems too strong, and so part of the revision here is to change the specificaton to be encouraging a particular interaction of errors and continuaton-inspection results, but not guaranteeing it. Meanwhile, when well-defined reflection on continuations is needed, continuation marks provide that functionality.