mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-23 20:05:32 +02:00
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.
This commit is contained in:
parent
b79ba0b01e
commit
4f692ace90
7 changed files with 8224 additions and 8116 deletions
|
@ -844,10 +844,12 @@ scm_for_each (SCM proc, SCM arg1, SCM args)
|
|||
static SCM
|
||||
scm_c_primitive_eval (SCM exp)
|
||||
{
|
||||
SCM transformer = scm_current_module_transformer ();
|
||||
if (scm_is_true (transformer))
|
||||
exp = scm_call_1 (transformer, exp);
|
||||
exp = scm_memoize_expression (exp);
|
||||
if (!SCM_MEMOIZED_P (exp))
|
||||
exp = scm_call_1 (scm_current_module_transformer (), exp);
|
||||
if (!SCM_MEMOIZED_P (exp))
|
||||
scm_misc_error ("primitive-eval",
|
||||
"expander did not return a memoized expression",
|
||||
scm_list_1 (exp));
|
||||
return eval (exp, SCM_EOL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue