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.devel Subject: Re: redo-safe-variables and redo-safe-parameters Date: Wed, 27 Mar 2013 14:22:00 +0100 Message-ID: References: <13378334.Jv25yq6OaM@warperdoze> <1767639.rWRbQJn65G@warperdoze> <5150614.XCd6n4rqTv@warperdoze> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1364390534 1825 80.91.229.3 (27 Mar 2013 13:22:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Mar 2013 13:22:14 +0000 (UTC) Cc: guile-devel To: Noah Lavine Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Mar 27 14:22:41 2013 Return-path: Envelope-to: guile-devel@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 1UKqJL-0001Gw-Ah for guile-devel@m.gmane.org; Wed, 27 Mar 2013 14:22:39 +0100 Original-Received: from localhost ([::1]:49388 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKqIx-00080a-81 for guile-devel@m.gmane.org; Wed, 27 Mar 2013 09:22:15 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:37657) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKqIo-0007rh-Sb for guile-devel@gnu.org; Wed, 27 Mar 2013 09:22:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKqIj-0008Nd-VJ for guile-devel@gnu.org; Wed, 27 Mar 2013 09:22:06 -0400 Original-Received: from mail-pb0-f52.google.com ([209.85.160.52]:39669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKqIj-0008NJ-Pb for guile-devel@gnu.org; Wed, 27 Mar 2013 09:22:01 -0400 Original-Received: by mail-pb0-f52.google.com with SMTP id ma3so5284345pbc.11 for ; Wed, 27 Mar 2013 06:22:01 -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=f+yhDP/FbgWe5dUGBuRaU6aZH1o86flYFjxwvgNBOvQ=; b=AI2uQc79lr+SVEdmGz7jAXa2fHRMJb9xp/DTWQpkp2kJ04JqZJg5Y8HDs0OoeJmPmk xk67LObfIlawumW+VZ/lYLdcBZgLMO28ZIPfF02qFgRPSjy/F5r05mOYXvyodQvKKRa8 K9xbNciGTKvF9LikTZUJcUWJlHdFs7XaSJhwrua244AXtjvzYsFF9txHotmwJS7ApdVl BiZ8U0JWBHHgRWJaJuwhMA/oY7bHdDjhPaiZ7NJn5i/aojTvq4JThuZaxZ/Q9E3lz38y 9dG51NNl+i8SKVcyfzwgC5T985QuyuYlWt2zmrnabJSybD86sBHkApgqN9ZmtUDbsy0C HVyQ== X-Received: by 10.66.100.138 with SMTP id ey10mr29326215pab.131.1364390521071; Wed, 27 Mar 2013 06:22:01 -0700 (PDT) Original-Received: by 10.70.45.8 with HTTP; Wed, 27 Mar 2013 06:22:00 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.160.52 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16021 Archived-At: On Wed, Mar 27, 2013 at 1:42 PM, Noah Lavine wrote: > Hello, > > Let me see if I understand the point of set! and set~. I think the goal is > to have a variable that is redo-safe, except that if someone uses set~ on > it, then it is not redo-safe. Is that right? No that would be hard to reason about. set~ and (~ a) indicate that you want to use it as a redo safe variable. set! and normal variable reference and you will get normal behavior in user code. > If so, I think a variable like that is too hard to think about. I really > don't think they should be in the language. I tried hard to make it possible to have it and as well be able to reason about it. Without support in the line I suggest it will be hard to reason about it. With it the hardness of the code will be optional. Want to stay in old scheme, don't use ~ variants in user code. Need the feature, use the ~ variants. > If you want to make a redo-safe variable act like it's not redo-safe, you > can use an explicit box. You do it like this: > > (redo-safe-variable ((a 1)) (set~ a (make-variable)) ...) > > Inside the ..., you don't set~ or set! a, you use variable-set!. That way, > if you capture the dynamic state and restore it, it just resets to being the > same box as it was before, which means that all of the dynamic states share > the same variable object and the same value. I think this is what Guile > would do for regular variables anyway - you just have to be explicit about > it here. Yeah that could be one thing to describe it, but I think that it's much nicer to let the code behave as scheme when the user code it as scheme as described above. > Note: this is actually a large part of the reason why I think > redo-safe-variables (or fluid-let variables) are a good idea. I saw a quote > from Sussman (one of the creators of Scheme) once that said that he should > have made Scheme with immutable variables and explicit boxes for mutable > locations. I think this is a reasonable extension of that > idea. Yeah but current complexity comes from the need of boxes that can be restored or not depending on context. But I fully agree with the statement above. Anyway I'm constantly imporving and learning about this I will hack on the speck, add more examples and motivation. We have barely touched the deeper aspects of this constructs e.g. the dynamic part of choosing when to store and when to not store. Thanks for your engagement! /Stefan