Handbook
Glossary
catch-stop-generator ( ..a try: ( ..a -- ..b ) except: ( ..a -- ..b ) -- ..b )
Vocabulary
generators
Inputs
try
a
quotation
except
a
quotation
Outputs
None
Word description
Attempts to run the
try
quotation. If a
stop-generator
error is thrown, then the
except
quotation will be run instead.
Definition
USING:
continuations
kernel
;
IN:
generators
:
catch-stop-generator
( ..a try: ( ..a -- ..b ) except: ( ..a -- ..b ) -- ..b )
[
dup
stop-generator?
[
drop
]
[
rethrow
]
if
]
prepose
recover
;
inline