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.

Source for ticket #362

cc


    

changetime

2012-10-11 23:26:40

component

WG1 - Core

description

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

id

362

keywords


    

milestone


    

owner

cowan

priority

major

reporter

cowan

resolution

fixed

severity


    

status

closed

summary

Editorial: Add exception example(s)

time

2012-03-21 14:23:49

type

defect

Changes

Change at time 2012-10-11 23:26:40

author

cowan

field

comment

newvalue


    

oldvalue

4

raw-time

1349972800058973

ticket

362

time

2012-10-11 23:26:40

Change at time 2012-10-11 23:26:40

author

cowan

field

resolution

newvalue

fixed

oldvalue


    

raw-time

1349972800058973

ticket

362

time

2012-10-11 23:26:40

Change at time 2012-10-11 23:26:40

author

cowan

field

status

newvalue

closed

oldvalue

writing

raw-time

1349972800058973

ticket

362

time

2012-10-11 23:26:40

Change at time 2012-07-07 04:03:31

author

cowan

field

comment

newvalue


    

oldvalue

3

raw-time

1341608611884865

ticket

362

time

2012-07-07 04:03:31

Change at time 2012-07-07 04:03:31

author

cowan

field

owner

newvalue

cowan

oldvalue

alexshinn

raw-time

1341608611884865

ticket

362

time

2012-07-07 04:03:31

Change at time 2012-07-07 04:03:31

author

cowan

field

status

newvalue

writing

oldvalue

decided

raw-time

1341608611884865

ticket

362

time

2012-07-07 04:03:31

Change at time 2012-03-22 03:12:44

author

cowan

field

comment

newvalue

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.

oldvalue

2

raw-time

1332360764679368

ticket

362

time

2012-03-22 03:12:44

Change at time 2012-03-21 14:24:05

author

cowan

field

comment

newvalue


    

oldvalue

1

raw-time

1332314645850024

ticket

362

time

2012-03-21 14:24:05

Change at time 2012-03-21 14:24:05

author

cowan

field

status

newvalue

decided

oldvalue

new

raw-time

1332314645850024

ticket

362

time

2012-03-21 14:24:05