From unknown Sun Sep 14 05:04:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18356: Should partial continuations capture the dynamic environment? Resent-From: Taylan Ulrich Bayirli/Kammer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 29 Aug 2014 18:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18356 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 18356@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.14093359453841 (code B ref -1); Fri, 29 Aug 2014 18:13:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Aug 2014 18:12:25 +0000 Received: from localhost ([127.0.0.1]:53739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XNQet-0000zs-Tz for submit@debbugs.gnu.org; Fri, 29 Aug 2014 14:12:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45277) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XNQeq-0000ze-Nd for submit@debbugs.gnu.org; Fri, 29 Aug 2014 14:12:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNQek-0002mn-Rx for submit@debbugs.gnu.org; Fri, 29 Aug 2014 14:12:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNQek-0002mj-PX for submit@debbugs.gnu.org; Fri, 29 Aug 2014 14:12:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNQej-0005mw-V9 for bug-guile@gnu.org; Fri, 29 Aug 2014 14:12:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XNQej-0002mP-4g for bug-guile@gnu.org; Fri, 29 Aug 2014 14:12:13 -0400 Received: from mail-la0-x230.google.com ([2a00:1450:4010:c03::230]:58089) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XNQei-0002m6-Sh for bug-guile@gnu.org; Fri, 29 Aug 2014 14:12:13 -0400 Received: by mail-la0-f48.google.com with SMTP id gl10so3204421lab.35 for ; Fri, 29 Aug 2014 11:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:to:subject; bh=YY+x+FUcLy1B581VOgnI5NEf4fhsbSjBUa0rG729aXA=; b=aoeEFQNxnrr+QHRH9XTFBhDLUyghBsISaDkszW0DKanLVI0loYjH1Gkru42V5ndj9b x6LYahvKYjGrOszLup88iYMYTBDZoxIAhv3Cxi5izy1NDVqqZGQ2PU+Uq/d8VFP1wY/2 IWvpPRBnJPMKYhbfX77IurbCdNuudkxpuaakFWYqkX7cJ9oVhHNdk3H21PgZt6YjvzzX runCwoUqEpI59Y4KCnRrUFT2vTTwdWFjqddcQ8Yu2OLPP+pl4OFU5q94Kwfn5ecU+LKg MebkUpZJsIdaeUknLrQoSwwmAvWAMCiP5BMwtik8AW3sbN+TzfaGziWjJw4Cjt7Bk5qT EakA== X-Received: by 10.152.23.6 with SMTP id i6mr12780033laf.39.1409335931176; Fri, 29 Aug 2014 11:12:11 -0700 (PDT) Received: from taylan.uni.cx (p200300514A1DE45B0213E8FFFEED36FB.dip0.t-ipconnect.de. [2003:51:4a1d:e45b:213:e8ff:feed:36fb]) by mx.google.com with ESMTPSA id js10sm423563lab.23.2014.08.29.11.12.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Aug 2014 11:12:10 -0700 (PDT) Date: Fri, 29 Aug 2014 20:12:09 +0200 Message-Id: <87lhq7go7a.fsf@taylan.uni.cx> From: Taylan Ulrich Bayirli/Kammer X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) On Guile 2.0.11: scheme@(guile-user)> (define (capture-dynenv) (let ((tag (make-prompt-tag "dynenv-capture"))) (call-with-prompt tag (lambda () ((abort-to-prompt tag))) (lambda (call-in-captured-dynenv) (lambda (proc) (call-in-captured-dynenv proc)))))) scheme@(guile-user)> (define param (make-parameter 0)) scheme@(guile-user)> (define dynenv (parameterize ((param 1)) (capture-dynenv))) scheme@(guile-user)> (parameterize ((param 2)) (dynenv (lambda () (param)))) $9 = 2 In other words, when a partial continuation is called, the dynamic environment at that call-time is in effect for the continuation, and not the one from when the continuation was captured. Is this behavior correct and what I'm trying to do won't work, or should the code return 1 as I had expected? For comparison, the following variant that uses call/cc works fine: (define (capture-dynenv) ((call/cc (lambda (call-in-captured-dynenv) (lambda () (lambda (proc) (call/cc (lambda (go-back) (call-in-captured-dynenv (lambda () (call-with-values proc go-back))))))))))) Taylan From unknown Sun Sep 14 05:04:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18356: Should partial continuations capture the dynamic environment? References: <87lhq7go7a.fsf@taylan.uni.cx> In-Reply-To: <87lhq7go7a.fsf@taylan.uni.cx> Resent-From: Taylan Ulrich Bayirli/Kammer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 29 Aug 2014 18:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18356 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 18356@debbugs.gnu.org Received: via spool by 18356-submit@debbugs.gnu.org id=B18356.14093368195261 (code B ref 18356); Fri, 29 Aug 2014 18:27:01 +0000 Received: (at 18356) by debbugs.gnu.org; 29 Aug 2014 18:26:59 +0000 Received: from localhost ([127.0.0.1]:53753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XNQsz-0001Mk-Gw for submit@debbugs.gnu.org; Fri, 29 Aug 2014 14:26:58 -0400 Received: from mail-lb0-f173.google.com ([209.85.217.173]:55608) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XNQsw-0001MV-N3 for 18356@debbugs.gnu.org; Fri, 29 Aug 2014 14:26:55 -0400 Received: by mail-lb0-f173.google.com with SMTP id c11so3061932lbj.32 for <18356@debbugs.gnu.org>; Fri, 29 Aug 2014 11:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:to:subject; bh=cnH34xw+aU23EgIYOLNwE9IJa6F22wIncyuMCUaLzPY=; b=xF8cNjlunyXYcXM7GF8+FIwGgfmDN3Z2cBm6qnFkjsRSxmxyfSwzYEOBCKBDz2klOm SXqAGlFwrSYedn09i8lg1Ofc/p2ATtCKb49Y9+Mo16iL9FBKS2Rh/4dvt56ANfZK2hSF xcM2yAbBFpIr26fTz7LZxFwum/spiAWQFi8WZu15X2wdRpYIUFo89ftztSQS3d3SPy/a y43KN7/itsHD2uyEVbHNVYw5d+RugW/H+LI8wzZHlNi1GgaegivxS9AJ1XOLLiEpH+eM 3+B9+0uf2706zBFH61B/nmoh9nMmF1fadKkpMeBSf9OP0G0b2iNvLKSt4PQU07Kicho9 mmCQ== X-Received: by 10.112.60.33 with SMTP id e1mr11927921lbr.36.1409336808580; Fri, 29 Aug 2014 11:26:48 -0700 (PDT) Received: from taylan.uni.cx (p200300514A1DE45B0213E8FFFEED36FB.dip0.t-ipconnect.de. [2003:51:4a1d:e45b:213:e8ff:feed:36fb]) by mx.google.com with ESMTPSA id x1sm449441lal.19.2014.08.29.11.26.47 for <18356@debbugs.gnu.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Aug 2014 11:26:48 -0700 (PDT) Date: Fri, 29 Aug 2014 20:26:47 +0200 Message-Id: <87k35rgniw.fsf@taylan.uni.cx> From: Taylan Ulrich Bayirli/Kammer X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Some more examples; this one works fine: scheme@(guile-user)> (define (with-captured-dynenv proc) (let ((tag (make-prompt-tag "dynenv-capture"))) (call-with-prompt tag (lambda () (proc (lambda (thunk) (abort-to-prompt tag thunk)))) (lambda (return thunk) (return (thunk)))))) scheme@(guile-user)> (define param (make-parameter 0)) scheme@(guile-user)> (parameterize ((param 1)) (with-captured-dynenv (lambda (dynenv) (parameterize ((param 2)) (dynenv (lambda () (param))))))) $2 = 1 But not this simpler one: scheme@(guile-user)> (define (with-captured-dynenv proc) (let ((tag (make-prompt-tag "dynenv-capture"))) (call-with-prompt tag (lambda () ((abort-to-prompt tag))) (lambda (call-in-captured-dynenv) (proc call-in-captured-dynenv))))) scheme@(guile-user)> (parameterize ((param 1)) (with-captured-dynenv (lambda (dynenv) (parameterize ((param 2)) (dynenv (lambda () (param))))))) $3 = 2 Taylan From unknown Sun Sep 14 05:04:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18356: Should partial continuations capture the dynamic environment? References: <87lhq7go7a.fsf@taylan.uni.cx> In-Reply-To: <87lhq7go7a.fsf@taylan.uni.cx> Resent-From: Taylan Ulrich Bayirli/Kammer Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 14 Oct 2014 14:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18356 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 18356@debbugs.gnu.org Received: via spool by 18356-submit@debbugs.gnu.org id=B18356.141329673814368 (code B ref 18356); Tue, 14 Oct 2014 14:26:02 +0000 Received: (at 18356) by debbugs.gnu.org; 14 Oct 2014 14:25:38 +0000 Received: from localhost ([127.0.0.1]:43392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xe32d-0003jd-Ic for submit@debbugs.gnu.org; Tue, 14 Oct 2014 10:25:36 -0400 Received: from mail-lb0-f171.google.com ([209.85.217.171]:43534) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xe32Z-0003jT-Cj for 18356@debbugs.gnu.org; Tue, 14 Oct 2014 10:25:32 -0400 Received: by mail-lb0-f171.google.com with SMTP id z12so8332132lbi.16 for <18356@debbugs.gnu.org>; Tue, 14 Oct 2014 07:25:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:to:subject; bh=NomlgBJqeaj5HOPT7907ZWd9g8f4qV17Ai7LF8Z2GaM=; b=RFfW/WGx13A4yfvSBKvw57bgJDH9o+hHdKMOzq65l6QKsGalu50mHvlnioZhgkRR04 OQ71LqZXiXsp/+LbeDHrleMLORMsdS6EVxOWLBOvFJTzxnvjMdl3N8EpVI04SL5s/OtE w273/NOyDWwnW7nG0qJN1zdI9qrfm/JaC+WlzEtQIBlKpUKrzLb5xhQmQZ5EGdp37XIB EURt+WcJtcdfMng8gCjOWageIft7UzYOMCPiJQXNwAdlnTqJsF2UuknLa27AUBH4qlcP SSXZX1U+Wznn7Fc/TKm9XGpDXOeNLKiBynA3ClVsPFyhXhx7S/PD/yimhRrxNklBYJ3s LAeA== X-Received: by 10.112.97.135 with SMTP id ea7mr5778519lbb.46.1413296729995; Tue, 14 Oct 2014 07:25:29 -0700 (PDT) Received: from taylan.uni.cx (p200300514A34D56C0213E8FFFEED36FB.dip0.t-ipconnect.de. [2003:51:4a34:d56c:213:e8ff:feed:36fb]) by mx.google.com with ESMTPSA id qg4sm5650543lbb.36.2014.10.14.07.25.28 for <18356@debbugs.gnu.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Oct 2014 07:25:29 -0700 (PDT) Date: Tue, 14 Oct 2014 16:25:27 +0200 Message-Id: <87iojmlodk.fsf@taylan.uni.cx> From: Taylan Ulrich Bayirli/Kammer X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) It has been explained on the #guile Freenode channel that this behavior is indeed desired and not a bug, being argued for by some authors of papers on delimited continuations: http://www.cs.utah.edu/plt/publications/icfp07-fyff.pdf http://okmij.org/ftp/papers/DDBinding.pdf In short, no: partial continuations in Guile should not (and do not) capture their dynamic environment. Thanks to Andy Wingo for the clarification. Taylan From unknown Sun Sep 14 05:04:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18356: Should partial continuations capture the dynamic environment? Resent-From: Nala Ginrut Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 14 Oct 2014 16:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18356 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: "Taylan Ulrich Bayirli/Kammer" Cc: 18356@debbugs.gnu.org Received: via spool by 18356-submit@debbugs.gnu.org id=B18356.14133053447500 (code B ref 18356); Tue, 14 Oct 2014 16:50:01 +0000 Received: (at 18356) by debbugs.gnu.org; 14 Oct 2014 16:49:04 +0000 Received: from localhost ([127.0.0.1]:43448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xe5HT-0001wt-6h for submit@debbugs.gnu.org; Tue, 14 Oct 2014 12:49:03 -0400 Received: from mail-lb0-f182.google.com ([209.85.217.182]:57211) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xe5HR-0001wU-Ah for 18356@debbugs.gnu.org; Tue, 14 Oct 2014 12:49:02 -0400 Received: by mail-lb0-f182.google.com with SMTP id z11so8364534lbi.41 for <18356@debbugs.gnu.org>; Tue, 14 Oct 2014 09:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ZGXD9nCrB6DuC7Pz+NadEMDMeWNPM8ZLIuFk2iYTQig=; b=tB1J5cCWjPpdxUZE/EPwaDs/pYjP5MK11j2vFafsjYPSnyqySwePZYFaYQaWIcDlWO poFHXa3GJrLSvog3PXibKhXVmq8iuUKyKuuv5SSnxYM8LH0Ex+53ZvYmuz9c1gYZTQ4v zE+dw4cLqCyv5mP4L+g9Emh4zT7NxfEOcWphoxm4vuHq58iG/7Y9BxWFdgCXh59u8zal 35XGkve+ChtN3Q9f+kLqEBv6tuGwTj1pOkag+QGJbQie4X3+bO2XzT6xB1zLYoHXQHW2 4q5A5qTysWkUt/Nh2+ICYmSytGLi7R9o1iX/rjd4kYoDvzxGvYryToxxEnhsozTMJ9k0 Efhg== MIME-Version: 1.0 X-Received: by 10.112.169.106 with SMTP id ad10mr6577747lbc.13.1413305339816; Tue, 14 Oct 2014 09:48:59 -0700 (PDT) Received: by 10.152.28.105 with HTTP; Tue, 14 Oct 2014 09:48:59 -0700 (PDT) In-Reply-To: <87iojmlodk.fsf@taylan.uni.cx> References: <87lhq7go7a.fsf@taylan.uni.cx> <87iojmlodk.fsf@taylan.uni.cx> Date: Wed, 15 Oct 2014 00:48:59 +0800 Message-ID: From: Nala Ginrut Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Thanks for researching and explaining this issue! It's helpful for me to think about how to deal with my async server design based on delimited-continuation. I think it's fine if it doesn't capture dynamic environment, even cooler, so that the dynamic state could be well understood and traced by users more easily. On Tue, Oct 14, 2014 at 10:25 PM, Taylan Ulrich Bayirli/Kammer wrote: > It has been explained on the #guile Freenode channel that this > behavior is indeed desired and not a bug, being argued for by some > authors of papers on delimited continuations: > > http://www.cs.utah.edu/plt/publications/icfp07-fyff.pdf > > http://okmij.org/ftp/papers/DDBinding.pdf > > > In short, no: partial continuations in Guile should not (and do not) > capture their dynamic environment. > > > Thanks to Andy Wingo for the clarification. > > Taylan > > > From unknown Sun Sep 14 05:04:11 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18356: Should partial continuations capture the dynamic environment? Resent-From: Mark H Weaver Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 15 Oct 2014 16:39:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18356 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Taylan Ulrich Bayirli/Kammer Cc: 18356@debbugs.gnu.org, Nala Ginrut , request@debbugs.gnu.org Received: via spool by 18356-submit@debbugs.gnu.org id=B18356.14133910945306 (code B ref 18356); Wed, 15 Oct 2014 16:39:03 +0000 Received: (at 18356) by debbugs.gnu.org; 15 Oct 2014 16:38:14 +0000 Received: from localhost ([127.0.0.1]:44673 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeRaX-0001NQ-Lv for submit@debbugs.gnu.org; Wed, 15 Oct 2014 12:38:14 -0400 Received: from world.peace.net ([96.39.62.75]:40374) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XeRaU-0001N7-Ig; Wed, 15 Oct 2014 12:38:11 -0400 Received: from c-24-62-95-23.hsd1.ma.comcast.net ([24.62.95.23] helo=yeeloong.lan) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1XeRaM-0005Hk-Lb; Wed, 15 Oct 2014 12:38:02 -0400 From: Mark H Weaver References: <87lhq7go7a.fsf@taylan.uni.cx> <87iojmlodk.fsf@taylan.uni.cx> Date: Wed, 15 Oct 2014 12:37:28 -0400 In-Reply-To: <87iojmlodk.fsf@taylan.uni.cx> (Taylan Ulrich Bayirli's message of "Tue, 14 Oct 2014 16:25:27 +0200") Message-ID: <87bnpd70hj.fsf@yeeloong.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tags 18356 + notabug close 18356 thanks Taylan Ulrich Bayirli/Kammer writes: > In short, no: partial continuations in Guile should not (and do not) > capture their dynamic environment. I think this requires further explanation, because the above statement is not quite correct. Partial continuations do not capture the _entire_ dynamic environment, but they *do* capture (and later restore) the _part_ of the dynamic environment that was established between the prompt and abort. Thinking in terms of 'dynamic-wind', 'abort-to-prompt' unwinds from the abort to the prompt, and when the partial continuation is later invoked, it will rewind from the prompt back to the abort before resuming the computation. Thinking in terms of dynamic environments, 'abort-to-prompt' captures the dynamic bindings that were established between the prompt and abort, and these captured bindings are composed on top of the dynamic environment of the call site when the partial continuation is later invoked. So, for example: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (call-with-prompt 'foo (lambda () (dynamic-wind (lambda () (display "entering\n")) (lambda () (abort-to-prompt 'foo)) (lambda () (display "leaving\n")))) (lambda (k) k)) entering leaving $1 = # scheme@(guile-user)> ($1 'hello) entering leaving $2 = hello --8<---------------cut here---------------end--------------->8--- Above, the 'dynamic-wind' between the prompt and abort is rewound when invoking the partial continuation. --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (dynamic-wind (lambda () (display "entering\n")) (lambda () (call-with-prompt 'foo (lambda () (abort-to-prompt 'foo)) (lambda (k) k))) (lambda () (display "leaving\n"))) entering leaving $3 = # scheme@(guile-user)> ($3 'hello) $4 = hello --8<---------------cut here---------------end--------------->8--- Above, the 'dynamic-wind' outside of the prompt is _not_ rewound when invoking the partial continuation. --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (define my-param (make-parameter #f)) scheme@(guile-user)> (call-with-prompt 'foo (lambda () (parameterize ((my-param 5)) ((abort-to-prompt 'foo)))) (lambda (k) k)) $5 = # scheme@(guile-user)> ($5 my-param) $6 = 5 --8<---------------cut here---------------end--------------->8--- Above, the dynamic binding of 'my-param' to 5 is restored when invoking the partial continuation, because it was established between the prompt and abort. --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (parameterize ((my-param 5)) (call-with-prompt 'foo (lambda () ((abort-to-prompt 'foo))) (lambda (k) k))) $7 = # scheme@(guile-user)> ($7 my-param) $8 = #f --8<---------------cut here---------------end--------------->8--- Above, the dynamic-binding of 'my-param' to 5 is _not_ restored, because it was established outside of the prompt. Mark