1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-16 16:50:21 +02:00

primitive-eval takes expanded, not memoized, source

* module/ice-9/eval.scm (primitive-eval):
* libguile/eval.c (scm_c_primitive_eval): Don't expect a memoized
  expression -- expect either raw source or an *expanded* expression. We
  handle memoization ourselves.

* libguile/expand.c (scm_macroexpand): Settle down into its proper name,
  "macroexpand", even as we comment that it is but a fleeting boot
  expander.
  (scm_macroexpanded_p): New predicate for expanded code.

* libguile/expand.h: Add scm_macroexpanded_p.

* libguile/memoize.c (scm_memoize_expression): Require that the
  expression be expanded.
  (scm_init_memoize): Don't alias memoize-expression to macroexpand.

* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm: Always produce macroexpanded expressions,
  and hand them to primitive-eval. No more calls to memoize-expression
  here.

* test-suite/tests/optargs.test: Remove some tests, as unfortunately we
  have no way to invoke the boot expander after boot.
This commit is contained in:
Andy Wingo 2010-05-20 12:25:52 +02:00
parent 3e5ea35c2f
commit a310a1d12e
8 changed files with 1485 additions and 1516 deletions

View file

@ -37,6 +37,7 @@
#include "libguile/deprecation.h"
#include "libguile/dynwind.h"
#include "libguile/eq.h"
#include "libguile/expand.h"
#include "libguile/feature.h"
#include "libguile/fluids.h"
#include "libguile/goops.h"
@ -832,13 +833,9 @@ scm_for_each (SCM proc, SCM arg1, SCM args)
static SCM
scm_c_primitive_eval (SCM exp)
{
if (!SCM_MEMOIZED_P (exp))
if (!SCM_EXPANDED_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);
return eval (scm_memoize_expression (exp), SCM_EOL);
}
static SCM var_primitive_eval;