summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-04 06:49:40 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-04 06:49:40 -0700
commitb856f42249c2b0d45910c519c5e4c656a4c4ec9f (patch)
tree81d2c4442ea653401f2e76949fd3605c378b3ebc /eval.c
parent50ddd3f5e3b33b98f783d579be567e950c9028ed (diff)
downloadtxr-b856f42249c2b0d45910c519c5e4c656a4c4ec9f.tar.gz
txr-b856f42249c2b0d45910c519c5e4c656a4c4ec9f.tar.bz2
txr-b856f42249c2b0d45910c519c5e4c656a4c4ec9f.zip
macro param lists: remove colon hack.
Going forward, when : appears as the argument of an optional parameter in destructuring, it is treated as an ordinary object, and not as "this argument is missing". That is now a feature of function calls only. Rationale: interferes with macros. For instance, the pattern (test : then else) doesn't correctly express the arguments of if, because (if x y :) eats the semicolon. The defaulting behavior is not useful because usually there is no default value for optional structure, other than nil. * eval.c (bind_macro_params): Only implement the colon hack under compatibility with 190. * share/txr/stdlib/place.tl (defplace gethash, defplace fun, defplace symbol-function, defplace symbol-macro, defplace symbol-value): Remove uses of : for defaulting the ssetter argument. This illustrates how useless the feature is for macro destructuring; all these just replace with nil. * txr.1: Clarify that macro parameter lists don't implement the colon trick. It was never explicitly specified that this is the case, but could have been inferred from the statements which indicate that macro parameter lists copy the features of function parameter lists. Added compat notes.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 73efc9e3..e16e8075 100644
--- a/eval.c
+++ b/eval.c
@@ -1232,7 +1232,7 @@ static val bind_macro_params(val env, val menv, val params, val form,
}
if (consp(form)) {
- if (optargs && car(form) == colon_k) {
+ if (optargs && opt_compat && opt_compat <= 190 && car(form) == colon_k) {
form = cdr(form);
goto noarg;
}