diff options
author | Andy Wingo <wingo@pobox.com> | 2010-05-20 12:25:52 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-05-20 12:25:52 +0200 |
commit | a310a1d12e9b44ba77bb28d5491f0bd378a90886 (patch) | |
tree | 37e0581a164c28bd7182ed3bfdff939f71127146 /libguile/expand.c | |
parent | 3e5ea35c2fa1bb3d21373723e9a51d213cf79187 (diff) | |
download | guile-a310a1d12e9b44ba77bb28d5491f0bd378a90886.tar.gz |
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.
Diffstat (limited to 'libguile/expand.c')
-rw-r--r-- | libguile/expand.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libguile/expand.c b/libguile/expand.c index 80bc48df6..4b9f0e147 100644 --- a/libguile/expand.c +++ b/libguile/expand.c @@ -1162,7 +1162,8 @@ expand_set_x (SCM expr, SCM env) -SCM_DEFINE (scm_macroexpand, "macroexpand*", 1, 0, 0, +/* This is the boot expander. It is later replaced with psyntax's sc-expand. */ +SCM_DEFINE (scm_macroexpand, "macroexpand", 1, 0, 0, (SCM exp), "Expand the expression @var{exp}.") #define FUNC_NAME s_scm_macroexpand @@ -1171,6 +1172,15 @@ SCM_DEFINE (scm_macroexpand, "macroexpand*", 1, 0, 0, } #undef FUNC_NAME +SCM_DEFINE (scm_macroexpanded_p, "macroexpanded?", 1, 0, 0, + (SCM exp), + "Return @code{#t} if @var{exp} is an expanded expression.") +#define FUNC_NAME s_scm_macroexpanded_p +{ + return scm_from_bool (SCM_EXPANDED_P (exp)); +} +#undef FUNC_NAME + |