From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] scm_module_variable, duplicate bindings handlers Date: Fri, 10 Aug 2007 16:53:31 +0200 Message-ID: <873ayrh250.fsf@chbouib.org> References: <87sl6rn2b4.fsf@pobox.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1186757656 9904 80.91.229.12 (10 Aug 2007 14:54:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 10 Aug 2007 14:54:16 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Aug 10 16:54:14 2007 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IJVsU-0000dg-4r for guile-devel@m.gmane.org; Fri, 10 Aug 2007 16:54:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IJVsT-0001Pr-JS for guile-devel@m.gmane.org; Fri, 10 Aug 2007 10:54:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IJVsQ-0001Mm-LB for guile-devel@gnu.org; Fri, 10 Aug 2007 10:54:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IJVsP-0001Kr-8C for guile-devel@gnu.org; Fri, 10 Aug 2007 10:54:09 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IJVsP-0001Kj-5S for guile-devel@gnu.org; Fri, 10 Aug 2007 10:54:09 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IJVsO-0005f1-NA for guile-devel@gnu.org; Fri, 10 Aug 2007 10:54:08 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IJVsK-0005w2-57 for guile-devel@gnu.org; Fri, 10 Aug 2007 16:54:04 +0200 Original-Received: from adh419.fdn.fr ([80.67.176.9]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Aug 2007 16:54:04 +0200 Original-Received: from ludo by adh419.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Aug 2007 16:54:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 62 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: adh419.fdn.fr X-URL: http://www.laas.fr/~lcourtes/ X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: i486-pc-linux-gnu User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:4NEMaz73EpGDeskzRzkiR4JmLms= X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:6676 Archived-At: Hi Andy, Andy Wingo writes: > 1) misordered-module-variable-lookup.patch, fixes the lookup order in > scm_module_variable to be like 1.8, which allows binders to run at the > correct time See comments below. > 2) duplicate-binding-use-module-variable.patch, fixes the duplicate > bindings handlers to lookup the resolved values using module-variable > rather than module-local-variable, as it is possible that public > interfaces use other modules. Ok, sounds good. > --- modules.c.~1.65.~ 2007-05-05 22:38:57.000000000 +0200 > +++ modules.c 2007-08-10 11:33:50.000000000 +0200 > @@ -418,15 +418,8 @@ > if (SCM_BOUND_THING_P (b)) > return b; > > - /* 2. Search imported bindings. In order to be consistent with > - `module-variable', the binder gets called only when no imported binding > - matches SYM. */ > - b = module_imported_variable (module, sym); > - if (SCM_BOUND_THING_P (b)) > - return SCM_BOOL_F; > - > { > - /* 3. Query the custom binder. */ > + /* 2. Query the custom binder. */ The rationale here was to be consistent with `module-variable', but it admittedly sounds questionable to look for imported variables here. > - /* 2. Search among the imported variables. */ > - var = module_imported_variable (module, sym); > - if (SCM_BOUND_THING_P (var)) > - return var; > - > { > - /* 3. Query the custom binder. */ > + /* 2. Query the custom binder. */ Here, the rationale was that invoking the custom binder is expensive and should be done as a last resort. OTOH, given how `module-autoload!' is implemented, it probably doesn't make any difference performance-wise to do things in the order you suggest, and it seems more consistent since it allows local variables to always override imported variables. So both patches make sense. You'll need to assign copyright to the FSF for Guile, though. We can discuss it privately if you want. Thanks! Ludovic. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel