diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-04-12 03:57:11 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-04-12 03:57:11 -0700 |
commit | 260173b6ad42a4643e6cde9ead210234bd47f545 (patch) | |
tree | 519f06b0f146b202fbf6c17501a4f37a3baf9d05 | |
parent | 46a4099f9fedf89d1a8cc45cf566750ab7284863 (diff) | |
download | txr-260173b6ad42a4643e6cde9ead210234bd47f545.tar.gz txr-260173b6ad42a4643e6cde9ead210234bd47f545.tar.bz2 txr-260173b6ad42a4643e6cde9ead210234bd47f545.zip |
Don't expand replacements of symbol macros.
* eval.c (expand_symacrolet, do_expand): Don't expand the
replacement form of a global or lexical symbol macro at the
time it is bound to its symbol. This is almost certainly
wrong in situations where it makes a difference.
* txr.1: Noted in compatibility section.
-rw-r--r-- | eval.c | 9 | ||||
-rw-r--r-- | share/txr/stdlib/place.tl | 4 |
2 files changed, 8 insertions, 5 deletions
@@ -1712,8 +1712,9 @@ static val expand_symacrolet(val form, val menv) val macro = car(symacs); val name = pop(¯o); val repl = pop(¯o); - val repl_ex = expand(repl, menv); - env_vbind(new_env, name, repl_ex); + env_vbind(new_env, name, + if3(opt_compat && opt_compat <= 137, + expand(repl, menv), repl)); } return maybe_progn(expand_forms(body, new_env)); @@ -3392,7 +3393,9 @@ tail: form_ex = rlcp(cons(sym, cons(name, cons(init_ex, nil))), form); if (sym == defsymacro_s) { - val result = eval(form_ex, make_env(nil, nil, nil), form); + val result = eval(if3(opt_compat && opt_compat <= 137, + form_ex, form), + make_env(nil, nil, nil), form); return cons(quote_s, cons(result, nil)); } else { mark_special(name); diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl index 5d17acb7..68567ed1 100644 --- a/share/txr/stdlib/place.tl +++ b/share/txr/stdlib/place.tl @@ -312,8 +312,8 @@ (getter-sym setter-sym update-body) : ((ssetter-sym clobber-body)) ((deleter-sym delete-body))) - (symacrolet ((name (car place-destructuring-args)) - (args (cdr place-destructuring-args))) + (let ((name (car place-destructuring-args)) + (args (cdr place-destructuring-args))) (unless (and name (symbolp name) (not (keywordp name)) |