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 /txr.1 | |
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 'txr.1')
-rw-r--r-- | txr.1 | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -30454,6 +30454,19 @@ parameter inside has a restricted scope in a nested parameter list: its parameter will capture just that part of the argument material which matches that parameter list, rather than the entire argument list. +The processing of macro parameter lists omits the feature that when the +keyword symbol +.code : +(colon) given as the argument to an optional parameter, that argument is +treated as a missing argument. This special logic is implemented only +in the function argument passing mechanism, not in the binding of macro +parameters to object structure. If the colon symbol appears in the object +structure and is matched against an optional parameter, it is an +ordinary value. That parameter is considered present, and takes on +that +.code : +keyword symbol as its value. + .TP* "Dialect Note:" In ANSI Common Lisp, the lambda list keyword @@ -63254,8 +63267,15 @@ function neglected to perform initializations, and didn't invoke finalization on the structure object if an exception was thrown during reinitialization. Thus, contrary to documented requirements, reinitialization of a structure didn't behave -like fresh construction. This behavior is replicated if compatibility -with 190 or earlier is requested. +like fresh construction. Also, until \*(TX 190, macro parameter +lists implemented the requirement that a +.code : +(colon keyword symbol) argument to an optional +was treated as a missing argument, triggering argument-defaulting behavior. +That requirement was removed; the colon symbol behaves as an ordinary value +under destructuring with macro parameter lists. +All these behaviors are restored in compatibility +with version 190 or earlier. .IP 188 Until \*(TX 188, .codn equal -based |