mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 08:10:17 +02:00
finish deprecating eval closures
* libguile/deprecated.h: * libguile/deprecated.c (scm_eval_closure_lookup) (scm_standard_eval_closure, scm_standard_interface_eval_closure) (scm_eval_closure_module): Deprecate these, as they are unused. * libguile/modules.h: * libguile/modules.c: Remove deprecated code. * module/oop/goops/util.scm (top-level-env, top-level-env?): Deprecate. * module/ice-9/deprecated.scm (set-system-module!): Deprecate. (module-eval-closure): Deprecate, by overriding the core definition to return a fresh eval closure. * module/ice-9/boot-9.scm (make-module): Don't set an eval closure on the module. (the-root-module, the-scm-module): Don't call set-system-module!.
This commit is contained in:
parent
3f48638c8c
commit
2de74cb56e
7 changed files with 120 additions and 151 deletions
|
@ -519,66 +519,6 @@ scm_module_ensure_local_variable (SCM module, SCM sym)
|
|||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
scm_t_bits scm_tc16_eval_closure;
|
||||
|
||||
#define SCM_F_EVAL_CLOSURE_INTERFACE (1<<0)
|
||||
#define SCM_EVAL_CLOSURE_INTERFACE_P(e) \
|
||||
(SCM_SMOB_FLAGS (e) & SCM_F_EVAL_CLOSURE_INTERFACE)
|
||||
|
||||
/* NOTE: This function may be called by a smob application
|
||||
or from another C function directly. */
|
||||
SCM
|
||||
scm_eval_closure_lookup (SCM eclo, SCM sym, SCM definep)
|
||||
{
|
||||
SCM module = SCM_PACK (SCM_SMOB_DATA (eclo));
|
||||
if (scm_is_true (definep))
|
||||
{
|
||||
if (SCM_EVAL_CLOSURE_INTERFACE_P (eclo))
|
||||
return SCM_BOOL_F;
|
||||
return scm_call_2 (SCM_VARIABLE_REF (module_make_local_var_x_var),
|
||||
module, sym);
|
||||
}
|
||||
else
|
||||
return scm_module_variable (module, sym);
|
||||
}
|
||||
|
||||
SCM_DEFINE (scm_standard_eval_closure, "standard-eval-closure", 1, 0, 0,
|
||||
(SCM module),
|
||||
"Return an eval closure for the module @var{module}.")
|
||||
#define FUNC_NAME s_scm_standard_eval_closure
|
||||
{
|
||||
SCM_RETURN_NEWSMOB (scm_tc16_eval_closure, SCM_UNPACK (module));
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
||||
SCM_DEFINE (scm_standard_interface_eval_closure,
|
||||
"standard-interface-eval-closure", 1, 0, 0,
|
||||
(SCM module),
|
||||
"Return a interface eval closure for the module @var{module}. "
|
||||
"Such a closure does not allow new bindings to be added.")
|
||||
#define FUNC_NAME s_scm_standard_interface_eval_closure
|
||||
{
|
||||
SCM_RETURN_NEWSMOB (scm_tc16_eval_closure | (SCM_F_EVAL_CLOSURE_INTERFACE<<16),
|
||||
SCM_UNPACK (module));
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
SCM_DEFINE (scm_eval_closure_module,
|
||||
"eval-closure-module", 1, 0, 0,
|
||||
(SCM eval_closure),
|
||||
"Return the module associated with this eval closure.")
|
||||
/* the idea is that eval closures are really not the way to do things, they're
|
||||
superfluous given our module system. this function lets mmacros migrate away
|
||||
from eval closures. */
|
||||
#define FUNC_NAME s_scm_eval_closure_module
|
||||
{
|
||||
SCM_MAKE_VALIDATE_MSG (SCM_ARG1, eval_closure, EVAL_CLOSURE_P,
|
||||
"eval-closure");
|
||||
return SCM_SMOB_OBJECT (eval_closure);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
SCM_SYMBOL (sym_macroexpand, "macroexpand");
|
||||
|
||||
SCM_DEFINE (scm_module_transformer, "module-transformer", 1, 0, 0,
|
||||
|
@ -936,9 +876,6 @@ scm_init_modules ()
|
|||
#include "libguile/modules.x"
|
||||
module_make_local_var_x_var = scm_c_define ("module-make-local-var!",
|
||||
SCM_UNDEFINED);
|
||||
scm_tc16_eval_closure = scm_make_smob_type ("eval-closure", 0);
|
||||
scm_set_smob_apply (scm_tc16_eval_closure, scm_eval_closure_lookup, 2, 0, 0);
|
||||
|
||||
the_module = scm_make_fluid ();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue