From 3f48638c8c82d7839b75204e475af691fcd67c33 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 23 May 2012 12:00:23 +0200 Subject: deprecate lookup closures * libguile/deprecated.h (SCM_TOP_LEVEL_LOOKUP_CLOSURE): * libguile/deprecated.c (scm_lookup_closure_module): (scm_module_lookup_closure): (scm_current_module_lookup_closure): Deprecate this part of the eval closure interface. It was unused internally, after the scm_sym2var refactor. * libguile/eval.h: * libguile/modules.c: * libguile/modules.h: Remove deprecated code. * libguile/goops.c (scm_ensure_accessor): Use scm_module_variable instead of calling the lookup closure. However I'm not sure that this code is used at all. --- libguile/deprecated.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'libguile/deprecated.c') diff --git a/libguile/deprecated.c b/libguile/deprecated.c index c19d58b85..a41f45461 100644 --- a/libguile/deprecated.c +++ b/libguile/deprecated.c @@ -2694,6 +2694,55 @@ scm_sym2var (SCM sym, SCM proc, SCM definep) } #undef FUNC_NAME +SCM +scm_lookup_closure_module (SCM proc) +{ + scm_c_issue_deprecation_warning + ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n" + "the manual, for replacements."); + + if (scm_is_false (proc)) + return scm_the_root_module (); + else if (SCM_EVAL_CLOSURE_P (proc)) + return SCM_PACK (SCM_SMOB_DATA (proc)); + else + /* FIXME: The `module' property is no longer set on eval closures, as it + introduced a circular reference that precludes garbage collection of + modules with the current weak hash table semantics (see + http://lists.gnu.org/archive/html/guile-devel/2009-01/msg00102.html and + http://thread.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2465 + for details). Since it doesn't appear to be used (only in this + function, which has 1 caller), we no longer extend + `set-module-eval-closure!' to set the `module' property. */ + abort (); +} + +SCM +scm_module_lookup_closure (SCM module) +{ + scm_c_issue_deprecation_warning + ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n" + "the manual, for replacements."); + + if (scm_is_false (module)) + return SCM_BOOL_F; + else + return SCM_MODULE_EVAL_CLOSURE (module); +} + +SCM +scm_current_module_lookup_closure () +{ + scm_c_issue_deprecation_warning + ("Eval closures are deprecated. See \"Accessing Modules From C\" in\n" + "the manual, for replacements."); + + if (scm_module_system_booted_p) + return scm_module_lookup_closure (scm_current_module ()); + else + return SCM_BOOL_F; +} + -- cgit v1.2.3