From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: BT Templeton Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] primitive resolution for public refs Date: Mon, 12 Mar 2012 17:05:36 -0400 Message-ID: <87wr6p1qe7.fsf@olor.terpri.org> References: <87haxt3h53.fsf@olor.terpri.org> <87aa3l3det.fsf@olor.terpri.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1331586382 20911 80.91.229.3 (12 Mar 2012 21:06:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 12 Mar 2012 21:06:22 +0000 (UTC) Cc: guile-devel@gnu.org To: Noah Lavine Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Mar 12 22:06:20 2012 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 1S7CRf-0005jW-Ga for guile-devel@m.gmane.org; Mon, 12 Mar 2012 22:06:19 +0100 Original-Received: from localhost ([::1]:47684 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7CRe-000677-PJ for guile-devel@m.gmane.org; Mon, 12 Mar 2012 17:06:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7CRG-0005vR-Fj for guile-devel@gnu.org; Mon, 12 Mar 2012 17:06:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7CRE-0007Sg-3f for guile-devel@gnu.org; Mon, 12 Mar 2012 17:05:54 -0400 Original-Received: from deleuze.hcoop.net ([69.90.123.67]:34923) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7CRD-0007Ri-Vw for guile-devel@gnu.org; Mon, 12 Mar 2012 17:05:52 -0400 Original-Received: from cpe-071-070-253-241.nc.res.rr.com ([71.70.253.241] helo=olor.terpri.org) by deleuze.hcoop.net with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.63) (envelope-from ) id 1S7CR7-00046V-53; Mon, 12 Mar 2012 17:05:45 -0400 In-Reply-To: (Noah Lavine's message of "Mon, 12 Mar 2012 15:42:01 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 69.90.123.67 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:14091 Archived-At: Noah Lavine writes: > Hello, > >> I don't think I've changed the correctness wrt `module-set!' and the >> like -- the current, private-refs-only optimization already exhibits the >> problem you describe: >> >> | scheme@(guile-user)> (define old-car car) >> | scheme@(guile-user)> (module-set! (current-module) > > I think (current-module) should be (guile) here. Otherwise I think you > will change 'car in (guile-user) and not affect (guile). But I have no > doubt that this bug is real. You're probably thinking of `module-define!'; `module-set!' mutates the variable object directly (whether it's imported from another module or not), so it works as written, modifying both (@ (guile-user) car) and (@ (guile) car). >> I'm not certain it's otherwise correct; I just added a workaround for >> the specific issue mentioned in the comment. > > Yes, you're right. > > That just raises the question, though: what's the right thing to do? I > realized that you could argue this is part of making a closure, > because it closes over the current value of variables in other > modules. That doesn't match the behavior of regular closures, though: > they just close over storage locations, so they can still be affected > by external set!'s. If the (guile) module and its variables were immutable by default, the optimization would be correct. Perhaps Guile could provide something similar to Common Lisp package locks: -- Inteligenta persono lernas la lingvon Esperanton rapide kaj facile. Esperanto estas moderna, kultura lingvo por la mondo. Simpla, fleksebla, belsona, Esperanto estas la praktika solvo de la problemo de universala interkompreno. Lernu la interlingvon Esperanton!