[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
‘with-exception-handler’ rationale
From: |
Nikita Karetnikov |
Subject: |
‘with-exception-handler’ rationale |
Date: |
Fri, 07 Mar 2014 17:34:19 +0400 |
I’ve expected ‘with-exception-handler’ to behave like ‘catch’, but it
doesn’t.
scheme@(guile-user)> ,use (srfi srfi-34)
scheme@(guile-user)> (with-exception-handler (const "got it") (lambda () (raise
"boom!")))
ice-9/boot-9.scm:106:20: In procedure #<procedure 94b0e40 at
ice-9/boot-9.scm:97:6 (thrown-k . args)>:
ice-9/boot-9.scm:106:20: Throw to key `srfi-34' with args `("boom!")'.
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>
scheme@(guile-user)> (catch 'misc-error (lambda () (error "boom!")) (const "got
it"))
$1 = "got it"
Is there an explanation that doesn’t involve diving into the land of
continuations and dynamic wind? I mean, when should I use the one but
not the other?
pgpFvydyiHgE3.pgp
Description: PGP signature
- ‘with-exception-handler’ rationale,
Nikita Karetnikov <=