diff options
-rw-r--r-- | eval.c | 6 | ||||
-rw-r--r-- | txr.1 | 14 |
2 files changed, 19 insertions, 1 deletions
@@ -2459,7 +2459,11 @@ static val me_quasilist(val form, val menv) val expand_forms(val form, val menv) { if (atom(form)) { - return form; + val ex_f = expand(form, menv); + if (consp(ex_f)) + uw_throwf(error_s, lit("symbol macro ~s in dot position must produce " + "atom form, not compound"), form, nao); + return ex_f; } else { val f = car(form); val r = cdr(form); @@ -10079,6 +10079,20 @@ Examples: (call (op list 1 . @1) 2) ;; yields 2 .cble +A special consideration is given to symbol macros which occur in the +dot position. If a symbol macro occurs in this position, then it must not +expand to a compound form, otherwise a macro-expansion-time error results. +If it expands to an atom, then it is substituted by that atom, and +the semantics of the function call proceeds as described above. + +.cblk + (symacrolet ((x (list 1 2))) + (list 1 . x)) ;; error: x expands to form (list 1 2) + + (symacrolet ((x 2)) + (list 1 . x)) ;; yields (1 . 2) +.cble + Dialect Note: In some other Lisp dialects like ANSI Common Lisp, the improper list syntax may |