This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
More tagbody
- From: "Are Meisfjord" <are at meisfjord dot com>
- To: kawa at sources dot redhat dot com
- Date: Thu, 3 Apr 2003 01:10:05 +0200
- Subject: More tagbody
Thanks for all the advice on tagbody! Letrec will certainly be better
than my original implementation. Below you can see the "manual
expansion" (I will rewrite the macro later) of a test case from
Franz' documentation. It returns 15, just as it's supposed to.
http://www.franz.com/support/documentation/5.0.1/ansicl/dictentr/tagbo
dy.htm
(define (test)
(let ((val '()))
(try-catch
(letrec ((start (lambda ()
(set! val 1)
(point-a)
(throw (make <java.lang.RuntimeException>))
(set! val (+ val 16))
(point-c)))
(point-c (lambda ()
(set! val (+ val 04))
(point-b)
(throw (make <java.lang.RuntimeException>))
(set! val (+ val 32))
(point-a)))
(point-a (lambda ()
(set! val (+ val 02))
(point-c)
(throw (make <java.lang.RuntimeException>))
(set! val (+ val 64))
(point-b)
(throw (make <java.lang.RuntimeException>))))
(point-b (lambda ()
(set! val (+ val 08)))))
(start))
(e <java.lang.RuntimeException> (+)))
val))
As you can see I get away with at most one exception thrown per
tagbody (any suggestions on how to get rid of it?), which is much
better than what I had originally. Again, thanks a lot!
Regards,
Are