--- 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 + + * 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 * 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