This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Ticket 362: Editorial: Add exception example(s)

2012-10-11 23:26:40
WG1 - Core
cowan
major
cowan
fixed
source
closed
2012-03-21 14:23:49
defect

We need to show how to use exceptions. SRFI 34 and R6RS may be useful sources.

statusnewdecided

Here's a possible candidate:

(let ((events '())) (guard (c (#t #f)) (guard (c ((dynamic-wind (lambda () (set! events (cons 'c events))) (lambda () #f) (lambda () (set! events (cons 'd events)))) #f)) (dynamic-wind (lambda () (set! events (cons 'a events))) (lambda () (raise 'error)) (lambda () (set! events (cons 'b events)))))) (reverse events))

should return (a b c d a b).

The important parts here are the dynamic extent in which the cond clauses are evaluated, and the dynamic extent of the implicit raise that occurs if none of the clauses fire. The extent/continuation of the cond evaluation is that of the whole guard, whereas the re-raise is that of the original raise.

This means that the first raise will trigger the a and b setters, and then the c and d setters will trigger. At this point, since the result is #f, the implementation should re-raise the object from the original calling extent, thus triggering a and b setters again, before finally returning without re-entering again.

owneralexshinncowan
statusdecidedwriting
resolutionfixed
statuswritingclosed