From a5ef086fc33cfbfce7b03bad291efa28acf739b2 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 28 Oct 2015 20:18:20 -0700 Subject: Implementing sys:abscond-from operator. * eval.c (sys_abscond_from_s): New symbol variable. (op_abscond_from): New static function. (do_expand): Handle abscond-from like return-from. (eval_init): Initialize sys_abscond_from_s and register sys:abscond-from operator. * share/txr/stdlib/yield.tl (yield-from): Use sys:abscond-from instead of return-from, to avoid tearing down the continuation's resources that it may need when restarted. * txr.1: Documented sys:abscond-from and added a mention to the Delimited Continuations introduction. * unwind.c (uw_abscond_to_exit_point): New static function. (uw_block_abscond): New function. * unwind.h (uw_block_abscond): Declared. --- share/txr/stdlib/yield.tl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'share') diff --git a/share/txr/stdlib/yield.tl b/share/txr/stdlib/yield.tl index 0a623a2b..ef0518e6 100644 --- a/share/txr/stdlib/yield.tl +++ b/share/txr/stdlib/yield.tl @@ -51,8 +51,9 @@ (let ((cont-sym (gensym))) ^(sys:yield-impl ',name (lambda (,cont-sym) - (return-from ,name (new (sys:yld-item - ,form (cdr ,cont-sym))))) + (sys:abscond-from ,name + (new (sys:yld-item + ,form (cdr ,cont-sym))))) ',ctx-form))) (defmacro yield (form) -- cgit v1.2.3