diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-04-04 06:49:40 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-04-04 06:49:40 -0700 |
commit | b856f42249c2b0d45910c519c5e4c656a4c4ec9f (patch) | |
tree | 81d2c4442ea653401f2e76949fd3605c378b3ebc /share | |
parent | 50ddd3f5e3b33b98f783d579be567e950c9028ed (diff) | |
download | txr-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 'share')
-rw-r--r-- | share/txr/stdlib/place.tl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl index d9fa60b3..6b4a1019 100644 --- a/share/txr/stdlib/place.tl +++ b/share/txr/stdlib/place.tl @@ -623,7 +623,7 @@ (macrolet ((,getter () ^(cdr ,',entry-sym)) (,setter (val) ^(sys:rplacd ,',entry-sym ,val))) ,body)))) - : + nil (deleter ^(macrolet ((,deleter () (if ,have-default-p @@ -763,7 +763,7 @@ ^(macrolet ((,getter () ^(fun ,',sym)) (,setter (val) ^(sys:setqf ,',sym ,val))) ,body)) - : + nil (deleter ^(macrolet ((,deleter (:env env) (when (lexical-fun-p env ',sym) @@ -805,7 +805,7 @@ (macrolet ((,getter () ^(call (car ,',gs-sym))) (,setter (val) ^(call (cdr ,',gs-sym) ,val))) ,body)))) - : + nil (deleter ^(macrolet ((,deleter () ^(fmakunbound ,',sym-expr))) ,body))) @@ -821,7 +821,7 @@ (macrolet ((,getter () ^(cdr ,',binding-sym)) (,setter (val) ^(sys:rplacd ,',binding-sym ,val))) ,body)))) - : + nil (deleter ^(macrolet ((,deleter () ^(mmakunbound ,',sym-expr))) ,body))) @@ -837,7 +837,7 @@ (macrolet ((,getter () ^(cdr ,',binding-sym)) (,setter (val) ^(sys:rplacd ,',binding-sym ,val))) ,body)))) - : + nil (deleter ^(macrolet ((,deleter () ^(makunbound ,',sym-expr))) ,body))) |