diff options
author | Andy Wingo <wingo@pobox.com> | 2010-05-07 10:51:28 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-05-07 22:22:19 +0200 |
commit | 4f692ace90f2dc75b83aa9e10d9cd107d2ea924e (patch) | |
tree | f01b7c934fe781a95ac5d95f8257d78db35b8e11 /libguile/modules.c | |
parent | b79ba0b01e7dc89d2ba8da2c5cf4e200f4bb5de1 (diff) | |
download | guile-4f692ace90f2dc75b83aa9e10d9cd107d2ea924e.tar.gz |
macro expanders return memoized expressions
* libguile/eval.c (scm_c_primitive_eval):
* module/ice-9/eval.scm (primitive-eval): Rely on the expander to
produce a memoized expression. If the expression is already memoized,
just pass it through (the equivalent of the old "noexpand" hack).
* libguile/memoize.c (scm_init_memoize): Initialize `memoize-expression'
as the initial binding of `macroexpand'.
* libguile/modules.c (scm_module_transformer): Before modules are
booted, look for `macroexpand', not `%pre-modules-transformer'.
* module/ice-9/boot-9.scm: No more %pre-modules-transformer. Loading
psyntax extends `macroexpand'.
(make-module): `macroexpand' is the default transformer.
* module/ice-9/psyntax.scm: No more `noexpand'.
(top-level-eval-hook, local-eval-hook): Instead of annotating with
noexpand, memoize the expression before handing it to primitive-eval.
(macroexpand): No more noexpand hack -- in its place we have another
hack, to memoize the result when running in eval mode.
* module/ice-9/psyntax-pp.scm: Regenerated.
Diffstat (limited to 'libguile/modules.c')
-rw-r--r-- | libguile/modules.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libguile/modules.c b/libguile/modules.c index ac15eaaac..a0c47f2db 100644 --- a/libguile/modules.c +++ b/libguile/modules.c @@ -564,7 +564,7 @@ scm_current_module_lookup_closure () return SCM_BOOL_F; } -SCM_SYMBOL (sym_sys_pre_modules_transformer, "%pre-modules-transformer"); +SCM_SYMBOL (sym_macroexpand, "macroexpand"); SCM_DEFINE (scm_module_transformer, "module-transformer", 1, 0, 0, (SCM module), @@ -572,13 +572,13 @@ SCM_DEFINE (scm_module_transformer, "module-transformer", 1, 0, 0, #define FUNC_NAME s_scm_module_transformer { if (SCM_UNLIKELY (scm_is_false (module))) - { SCM v = scm_hashq_ref (scm_pre_modules_obarray, - sym_sys_pre_modules_transformer, + { + SCM v = scm_hashq_ref (scm_pre_modules_obarray, + sym_macroexpand, SCM_BOOL_F); if (scm_is_false (v)) - return SCM_BOOL_F; - else - return SCM_VARIABLE_REF (v); + SCM_MISC_ERROR ("no module, and `macroexpand' unbound", SCM_EOL); + return SCM_VARIABLE_REF (v); } else { |