unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: "Ludovic Courtès" <ludo@gnu.org>, guile-devel <guile-devel@gnu.org>
Subject: [PATCH] scm_module_variable, duplicate bindings handlers
Date: Fri, 10 Aug 2007 11:53:19 +0200	[thread overview]
Message-ID: <87sl6rn2b4.fsf@pobox.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

Hey folks,

I've gotten guile-gnome to run against guile HEAD now, with the help of
the following patches:

 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

 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.

Cheers,

Andy.
-- 
http://wingolog.org/


[-- Attachment #2: misordered-module-variable-lookup.patch --]
[-- Type: text/x-diff, Size: 1972 bytes --]

--- ChangeLog.~1.2396.~	2007-08-04 16:11:09.000000000 +0200
+++ ChangeLog	2007-08-10 11:41:05.000000000 +0200
@@ -1,3 +1,9 @@
+2007-08-10  Andy Wingo  <wingo@pobox.com>
+
+	* modules.c (scm_module_variable, scm_module_local_variable): Fix
+	misordered lookup sequence: it should be obarray, binder, imports
+	rather than obarray, imports, binder.
+
 2007-07-29  Ludovic Courtès  <ludo@gnu.org>
 
 	* Makefile.am (INCLUDES): Added Gnulib includes.
--- 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.  */
     SCM binder = SCM_MODULE_BINDER (module);
 
     if (scm_is_true (binder))
@@ -437,8 +430,11 @@
       }
   }
 
-  return SCM_BOOL_F;
 
+  /* 3. No need to search imported bindings, because we are only looking for
+     local variables.  */
+
+  return SCM_BOOL_F;
 #undef SCM_BOUND_THING_P
 }
 #undef FUNC_NAME
@@ -465,13 +461,8 @@
   if (SCM_BOUND_THING_P (var))
     return var;
 
-  /* 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.  */
     SCM binder;
 
     binder = SCM_MODULE_BINDER (module);
@@ -483,6 +474,11 @@
       }
   }
 
+  /* 3. Search among the imported variables.  */
+  var = module_imported_variable (module, sym);
+  if (SCM_BOUND_THING_P (var))
+    return var;
+
   return SCM_BOOL_F;
 
 #undef SCM_BOUND_THING_P

[-- Attachment #3: duplicate-binding-use-module-variable.patch --]
[-- Type: text/x-diff, Size: 1190 bytes --]

--- ChangeLog.~1.682.~	2007-05-05 22:38:56.000000000 +0200
+++ ChangeLog	2007-08-10 11:43:49.000000000 +0200
@@ -1,3 +1,10 @@
+2007-08-10  Andy Wingo  <wingo@pobox.com>
+
+	* boot-9.scm (duplicate-handlers): When looking for a variable's
+	binding in a interface, use module-variable rather than
+	module-local-variable, as public interfaces can also use other
+	modules.
+
 2007-05-05  Ludovic Courtès  <ludo@chbouib.org>
 
 	Implemented lazy duplicate binding handling.  Fixed the
--- boot-9.scm.~1.361.~	2007-05-05 22:38:56.000000000 +0200
+++ boot-9.scm	2007-08-09 13:42:44.000000000 +0200
@@ -3088,13 +3088,13 @@
 		     (module-name module)
 		     (module-name int2)
 		     name)
-	     (module-local-variable int2 name))))
+	     (module-variable int2 name))))
      
     (define (first module name int1 val1 int2 val2 var val)
-      (or var (module-local-variable int1 name)))
+      (or var (module-variable int1 name)))
      
     (define (last module name int1 val1 int2 val2 var val)
-      (module-local-variable int2 name))
+      (module-variable int2 name))
      
     (define (noop module name int1 val1 int2 val2 var val)
       #f)

[-- Attachment #4: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel

             reply	other threads:[~2007-08-10  9:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-10  9:53 Andy Wingo [this message]
2007-08-10 14:53 ` [PATCH] scm_module_variable, duplicate bindings handlers Ludovic Courtès
2007-08-13  9:08   ` Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sl6rn2b4.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).