(catch 'result
(setq i 0 j 0)
(loop (incf j 3) (incf i)
(if (= i 3) (throw 'result (values i j))))) 3, 9
(catch nil
(unwind-protect (throw nil 1)
(throw nil 2))) 2
The consequences of the following are undefined
because the catch of b
is passed over by the first throw,
hence portable programs must assume that
its dynamic extent is terminated.
The binding of the catch tag is not yet disestablished
and therefore it is the target of the second throw.
(catch 'a
(catch 'b
(unwind-protect (throw 'a 1)
(throw 'b 2))))
The following prints "The inner catch returns :SECOND-THROW"
and then returns :outer-catch.
(catch 'foo
(format t "The inner catch returns ~s.~%"
(catch 'foo
(unwind-protect (throw 'foo :first-throw)
(throw 'foo :second-throw))))
:outer-catch)
The inner catch returns :SECOND-THROW
:OUTER-CATCH