From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.bugs Subject: bug#14039: Bug in with-fluids semantics Date: Sat, 23 Mar 2013 18:58:05 +0100 Message-ID: References: <7932480.qaFp3n8hK8@warperdoze> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1364061545 30941 80.91.229.3 (23 Mar 2013 17:59:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Mar 2013 17:59:05 +0000 (UTC) Cc: 14039@debbugs.gnu.org To: Daniel Hartwig Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Mar 23 18:59:31 2013 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 1UJSj2-0003Pj-54 for guile-bugs@m.gmane.org; Sat, 23 Mar 2013 18:59:28 +0100 Original-Received: from localhost ([::1]:52140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJSie-0004Ae-N1 for guile-bugs@m.gmane.org; Sat, 23 Mar 2013 13:59:04 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJSia-0004A7-H8 for bug-guile@gnu.org; Sat, 23 Mar 2013 13:59:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJSiZ-0005EC-GD for bug-guile@gnu.org; Sat, 23 Mar 2013 13:59:00 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJSiZ-0005E8-CB for bug-guile@gnu.org; Sat, 23 Mar 2013 13:58:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UJSkY-0001Li-2q for bug-guile@gnu.org; Sat, 23 Mar 2013 14:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Israelsson Tampe Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 23 Mar 2013 18:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14039 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 14039-submit@debbugs.gnu.org id=B14039.13640616125132 (code B ref 14039); Sat, 23 Mar 2013 18:01:02 +0000 Original-Received: (at 14039) by debbugs.gnu.org; 23 Mar 2013 18:00:12 +0000 Original-Received: from localhost ([127.0.0.1]:42484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UJSjk-0001Kj-5X for submit@debbugs.gnu.org; Sat, 23 Mar 2013 14:00:12 -0400 Original-Received: from mail-pd0-f182.google.com ([209.85.192.182]:60197) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UJSjh-0001Kb-Ns for 14039@debbugs.gnu.org; Sat, 23 Mar 2013 14:00:10 -0400 Original-Received: by mail-pd0-f182.google.com with SMTP id y10so2025213pdj.27 for <14039@debbugs.gnu.org>; Sat, 23 Mar 2013 10:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=62vtbcQu9ih3EsK9nLTZU4aL5nEZhRk/qQDKWmBLj/g=; b=fdUe+QgkbCN/S9TxEE2zDFy1YhEC75q6NEbwvHa4T38gnR6m42kqzkimcPD3hyPxtj f5Br9QcwWkQ2Vgsz12dFfVkkEZITN8xQzcZ61jDaxemdMvjjd8RwAjnn66wQ3U6hqCT8 Fviq3k0o2QzzNgqlYv2G/Bh3YZBByxbN5hOBzqdVT16uNHrr5mFvoDx3v0c+BRL3Z4oV +Tetu2R/BAa0vv7GrCb0ZlL5h9t2cL9ut1gxfDKTUZmFVdMaGXgdxIvSqA+p0Ao55usH FxTTe+zRhTrqF9Qf30Kme3iGjdAZL0n3M4Rw8I45ASfb0SSpZ59J0Gk8Z87viVCiQIxh /C8A== X-Received: by 10.66.221.226 with SMTP id qh2mr9592021pac.62.1364061486004; Sat, 23 Mar 2013 10:58:06 -0700 (PDT) Original-Received: by 10.70.45.8 with HTTP; Sat, 23 Mar 2013 10:58:05 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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:6999 Archived-At: Ok, I've been meditating over this question and really I can't find a single use case where the current behavior is prefered with an optimized path and the more natural behavior where undo and redo works is dismissed as a faulty semantics with a slow path. But not only this if my suggested change to the VM op semantics is implemented we could probably add a function via the C wrapper framework to to the other half of the swap in order to keep the current semantics. Then we can force those who uses this semantics to change there code to include the old behavior if they wish. Or we might take the defensive route to do the otehr way around. WDYT, can you find a use case where the current behavir is prefered? /Stefan On Sat, Mar 23, 2013 at 3:51 PM, Daniel Hartwig wrote: > On 23 March 2013 18:41, Stefan Israelsson Tampe wrote: >> Consider this simple exmple with fluids and reodos via propmts, >> >> (define (f x) >> (let ((s (make-fluid 0))) >> (with-fluids ((s 0)) >> (let lp ((i 0)) >> (cond ((>= i 100) (fluid-ref s)) >> ((= i 50) (abort-to-prompt 'tag) (lp (+ i 1))) >> (else (fluid-set! s (+ (fluid-ref s) i)) >> (lp (+ i 1)))))))) >> >> (define k (call-with-prompt 'tag (lambda () (f 1)) (lambda (k . l) >> k))) >> >> Then we will get in guile-2.0 pretty resent git version >> scheme@(guile-user)> (k) >> $1 = 4900 >> scheme@(guile-user)> (k) >> $2 = 8575 >> > > What values do you expect from successive calls to K? > >> The reason is that when the with-fluid returns normally it does a full >> swap. It should only do half a swap e.g. restore the old value of the >> fluid and not store the current which is of non use because it can not >> be reached anymore and it contaminates the continuation k. > > K captures S, a fluid, along with the dynamic extent. There is only a > single dynamic extent to which K resumes, and only one value > associated to the fluid S within that. Subsequent calls to K do not > generate a new dynamic extent, so it makes sense that modifications to > the fluids value persist. This example behaives as expected according > to my understanding of fluids. > > Am I missing something?