summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-12-08 21:34:13 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-12-08 21:34:13 -0800
commita6022e54d73dc294b357d5e5352aed331d9585e3 (patch)
treec2e5611f5379b3310bdf1d931b76305961da4305 /eval.c
parentddbf5c05006e113608ac3c57f6d403bdebcc20a5 (diff)
downloadtxr-a6022e54d73dc294b357d5e5352aed331d9585e3.tar.gz
txr-a6022e54d73dc294b357d5e5352aed331d9585e3.tar.bz2
txr-a6022e54d73dc294b357d5e5352aed331d9585e3.zip
Allow defmacros and defuns to co-exist.
Already we have the situation that there is an if function and an if macro, and same for and and or. This change allows such situations to be programmer-defined. * eval.c (op_defun): Don't remhash the name from the toplevel macro bindings. (op-defmacro): Don't remhash the name from the toplevel function bindings. * txr.1: Document the permissive behavior as dialect notes under defmacro and defun.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index c2c62b6c..31ce0733 100644
--- a/eval.c
+++ b/eval.c
@@ -1523,8 +1523,6 @@ static val op_defun(val form, val env)
val block = cons(block_s, cons(name, body));
val fun = cons(name, cons(params, cons(block, nil)));
- remhash(top_mb, name);
-
/* defun captures lexical environment, so env is passed */
sethash(top_fb, name, cons(name, func_interp(env, fun)));
if (eval_initing)
@@ -1557,7 +1555,6 @@ static val op_defmacro(val form, val env)
if (gethash(op_table, name))
eval_error(form, lit("defmacro: ~s is a special operator"), name, nao);
- remhash(top_fb, name);
/* defmacro captures lexical environment, so env is passed */
sethash(top_mb, name,
rlcp_tree(cons(name, cons(env, cons(params, cons(block, nil)))),