From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Chris Vine Newsgroups: gmane.lisp.guile.user Subject: Re: dynamic-wind Date: Sun, 9 Jul 2017 13:59:21 +0100 Message-ID: <20170709135921.0f4890ad@bother.homenet> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1499605233 14860 195.159.176.226 (9 Jul 2017 13:00:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 9 Jul 2017 13:00:33 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Jul 09 15:00:24 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dUBoy-00039Z-6G for guile-user@m.gmane.org; Sun, 09 Jul 2017 15:00:20 +0200 Original-Received: from localhost ([::1]:36156 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUBp1-0005gP-MX for guile-user@m.gmane.org; Sun, 09 Jul 2017 09:00:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38202) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUBoV-0005gG-FO for guile-user@gnu.org; Sun, 09 Jul 2017 08:59:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUBoR-0003rN-7f for guile-user@gnu.org; Sun, 09 Jul 2017 08:59:51 -0400 Original-Received: from mail-wr0-x236.google.com ([2a00:1450:400c:c0c::236]:33439) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUBoQ-0003cx-Ve for guile-user@gnu.org; Sun, 09 Jul 2017 08:59:47 -0400 Original-Received: by mail-wr0-x236.google.com with SMTP id r103so104360443wrb.0 for ; Sun, 09 Jul 2017 05:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:in-reply-to:mime-version :content-transfer-encoding; bh=DtuHSRm09inlMxySKp8utAbdSE2oPkxU37eWdgj2ijM=; b=D0xMuh3yx9NID8bAD7ZRQNN0NZqG0KvLfX4dGX+ouVP7/P66Exf800lsbUv+om95w8 1ATtjCsTCfOAJcaDzsXdWBvDsE/hPSAh+jH7GrpR9rP9QRx6B05CZLxHY+Mn6hpk7QSd ruGqeEsV1Bjha1yZePps9PBdfdrWecAByzoQyQU/weAxNBoSuHhXr/hh0B/iY1uKst// PoYrLJ1ML/1GOhwu62LGvxhVEeEOUCk0l/yT0RkTdVTva9vSGdNqJQE4LN7wuPLKm8oc ELW2fswvtx56Ieew4YhT9xJb7MURoGApSsiNlVTLeOgx+mFOCKCQaTdd3KOGS6QOQ/T4 GmYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :mime-version:content-transfer-encoding; bh=DtuHSRm09inlMxySKp8utAbdSE2oPkxU37eWdgj2ijM=; b=tX6DrOjPRCgMR9MTNQjmRZ8qZbmT6dJoqo6q7uepqFaTlIy6wv/ru88m/2RKtQ0G2g yEizx2xfNKVoKBOsgEOqJrVd09XAA0U1Nq6wblG97CcP8x9sDkLpBBrhk+zQAKEoa089 RkFp2C9UCAQerKlUFBeS6d5Df57fzvQO26ktRW4WpuwKcVsXRhS4V0vb++ZvFYF8+Zz9 rIGazW9ICj14TmEm6ASJ15WkPHGn7SXXRLYmFg/H0u5z9azwhAk6+lK0FR1zetZNEb9Y 6g1JF+f9U1duDTLIxLuTWBQPVQpF6jO/NK0Z+YwmdFAO3QPKyqGJIOYLfaGiawESM98I t49A== X-Gm-Message-State: AIVw113qXWogEhorxY1q5/COlJOhY43d9Vhw+F/Pdc/rSutLX8s6LYeg eLbLslf+G96AFtce X-Received: by 10.28.100.8 with SMTP id y8mr4709095wmb.83.1499605163071; Sun, 09 Jul 2017 05:59:23 -0700 (PDT) Original-Received: from bother.homenet ([95.146.108.69]) by smtp.gmail.com with ESMTPSA id k12sm9982918wrc.10.2017.07.09.05.59.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 09 Jul 2017 05:59:22 -0700 (PDT) Original-Received: from bother.homenet (localhost [IPv6:::1]) by bother.homenet (Postfix) with ESMTP id 7E9F0260344 for ; Sun, 9 Jul 2017 13:59:21 +0100 (BST) X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) In-Reply-To: 87r2xqmx4a.fsf@elektro.pacujo.net X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::236 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:13910 Archived-At: On Sun, 09 Jul 2017 00:34:13 +0300 Marko Rauhamaa writes: > Hm. Python's try/finally has several uses in virtually every > program. > > Trouble is, Scheme's continuations make it impossible to know when > something is really final. > > In fact, implementing coroutines and cooperative multitasking using > continuations almost guarantee a repeated back-and-forth through > dynamic-wind. > > I strongly suspect Scheme's continuations are more trouble than they > are worth. I disagree with that. On the first point, you know that a dynamic-wind block can no longer be re-entered (if that is what you mean by "really final") when the continuation object concerned is no longer accessible. At that point it, and all references to other objects encapsulated by the continuation, will be released in the ordinary way. You also know the same when your continuation is only an escape continuation. Secondly, this is something of an irrelevance. I have found it very rare that one would want to use dynamic-wind when implementing co-operative multi-tasking with coroutines (at any rate, https://github.com/ChrisVine/guile-a-sync only does so for thread pool thread counts, and that is to cater for exceptions in local code rather than for jumps via continuation objects). Jumping out of a dynamic-wind block using a coroutine is generally inimical to the kind of asynchronous programming that coroutines are used for: you generally don't want to unset the state of the continuation, and then set it up again when you re-enter. You normally want to leave it just as it was at the time you yielded. I may be mistaking you for another poster, but I think you have previously said that you prefer the inversion of control ("callback hell") style of asynchronous programming to using coroutines. You would not usually think of using dynamic-wind there either, I hope. Scheme's continuations are very useful. Guile's delimited continuations are even more so. Dynamic-wind not so much, because it is a very blunt instrument. Chris