From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Zefram Newsgroups: gmane.lisp.guile.bugs Subject: bug#21894: escape continuation doc wrong about reinvokability Date: Thu, 12 Nov 2015 23:27:42 +0000 Message-ID: <20151112232742.GA19689@fysh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1447370896 27669 80.91.229.3 (12 Nov 2015 23:28:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Nov 2015 23:28:16 +0000 (UTC) To: 21894@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Nov 13 00:28:07 2015 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zx1Hj-00056s-M2 for guile-bugs@m.gmane.org; Fri, 13 Nov 2015 00:28:07 +0100 Original-Received: from localhost ([::1]:50250 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zx1Hj-000899-5G for guile-bugs@m.gmane.org; Thu, 12 Nov 2015 18:28:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zx1Hf-00088d-O3 for bug-guile@gnu.org; Thu, 12 Nov 2015 18:28:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zx1He-00005u-SE for bug-guile@gnu.org; Thu, 12 Nov 2015 18:28:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zx1He-00005m-PF for bug-guile@gnu.org; Thu, 12 Nov 2015 18:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zx1He-0003yb-Ev for bug-guile@gnu.org; Thu, 12 Nov 2015 18:28:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 12 Nov 2015 23:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21894 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.144737087315266 (code B ref -1); Thu, 12 Nov 2015 23:28:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Nov 2015 23:27:53 +0000 Original-Received: from localhost ([127.0.0.1]:35229 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zx1HU-0003y9-Ix for submit@debbugs.gnu.org; Thu, 12 Nov 2015 18:27:52 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:59028) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zx1HS-0003y1-AH for submit@debbugs.gnu.org; Thu, 12 Nov 2015 18:27:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zx1HR-0008Uc-23 for submit@debbugs.gnu.org; Thu, 12 Nov 2015 18:27:49 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:53985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zx1HQ-0008UY-Vi for submit@debbugs.gnu.org; Thu, 12 Nov 2015 18:27:48 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zx1HP-00082C-Q3 for bug-guile@gnu.org; Thu, 12 Nov 2015 18:27:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zx1HO-0008U1-Mk for bug-guile@gnu.org; Thu, 12 Nov 2015 18:27:47 -0500 Original-Received: from river6.fysh.org ([2001:41d0:d:20da::2]:50350 helo=river.fysh.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zx1HO-0008Su-Gm for bug-guile@gnu.org; Thu, 12 Nov 2015 18:27:46 -0500 Original-Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian)) id 1Zx1HK-0005w1-GJ; Thu, 12 Nov 2015 23:27:42 +0000 Content-Disposition: inline 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7892 Archived-At: The manual says # Escape continuations are delimited continuations whose # only use is to make a non-local exit--i.e., to escape from the current # continuation. Such continuations are invoked only once, and for this # reason they are sometimes called "one-shot continuations". O RLY? scheme@(guile-user)> (use-modules (ice-9 control)) scheme@(guile-user)> (define cc #f) scheme@(guile-user)> (list 'a (let/ec e (list 'b (e (call-with-current-continuation (lambda (c) (set! cc c) 0)))))) $1 = (a 0) scheme@(guile-user)> (cc 1) $2 = (a 1) scheme@(guile-user)> (cc 2) $3 = (a 2) Clearly I have invoked this escape continuation, successfully, more than once. The semantics here are perfectly sensible, it's just the documentation that's off the mark, because it ignores how escape continuations interact with other kinds of continuation. I suggest changing "Such continuations are invoked only once" sentence to something like Such continuations can only be invoked from within the dynamic extent of the call to which they will jump. Because the jump ends that extent, if escape continuations are the only kind of continuations being used it is only possible to invoke an escape continuation at most once. For this reason they are sometimes called "one-shot continuations", but that is a misnomer when other kinds of continuations are also in use. Most kinds can reinstate a dynamic extent that has been exited, and if the extent of an escape continuation is reinstated then it can be invoked again to exit that extent again. Conversely, an escape continuation cannot be invoked from a separate thread that has its own dynamic state not including the continuation's extent, even if the continuation's extent is still in progress in its original thread and the continuation has never been invoked. -zefram