From 73dea589ca6eb3361cf9583a09f8272f546ee3bf Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 2 Sep 2008 00:49:17 -0700 Subject: [PATCH] module-variable accesses pre-module-obarray if module is #f * libguile/modules.c (module-variable): If module is #f, access the pre-modules-array. This is so that nested-ref can work before the module system is booted, I think. Of course all of these dependency lines during bootstrap are just to make sure the system can be booted properly, either interpreted or compiled, so there's no one right way: there are many ways that could work. --- libguile/modules.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libguile/modules.c b/libguile/modules.c index 168fbce60..d99d3e472 100644 --- a/libguile/modules.c +++ b/libguile/modules.c @@ -336,6 +336,8 @@ resolve_duplicate_binding (SCM module, SCM sym, return result; } +SCM scm_pre_modules_obarray; + /* Lookup SYM as an imported variable of MODULE. */ static inline SCM module_imported_variable (SCM module, SCM sym) @@ -462,6 +464,9 @@ SCM_DEFINE (scm_module_variable, "module-variable", 2, 0, 0, SCM_VALIDATE_SYMBOL (2, sym); + if (scm_is_false (module)) + return scm_hashq_ref (scm_pre_modules_obarray, sym, SCM_UNDEFINED); + /* 1. Check module obarray */ var = scm_hashq_ref (SCM_MODULE_OBARRAY (module), sym, SCM_UNDEFINED); if (SCM_BOUND_THING_P (var)) @@ -628,8 +633,6 @@ SCM_DEFINE (scm_module_import_interface, "module-import-interface", 2, 0, 0, * the scm_pre_modules_obarray (a `eq' hash table). */ -SCM scm_pre_modules_obarray; - SCM scm_sym2var (SCM sym, SCM proc, SCM definep) #define FUNC_NAME "scm_sym2var"