diff options
-rw-r--r-- | eval.c | 23 | ||||
-rw-r--r-- | txr.1 | 18 |
2 files changed, 35 insertions, 6 deletions
@@ -3157,12 +3157,23 @@ static val me_case(val form, val menv) if (keys == t) eval_error(form_orig, lit("~s: symbol t used as key"), casesym, nao); - ptail = list_collect(ptail, - cons(list(if3(atom(keys), eqfuncsym, memfuncsym), - tformsym, - if3(atom(keys), keys, list(quote_s, keys, nao)), - nao), - forms)); + if (opt_compat && opt_compat <= 156) { + ptail = list_collect(ptail, + cons(list(if3(atom(keys), eqfuncsym, memfuncsym), + tformsym, + if3(atom(keys), + keys, + list(quote_s, keys, nao)), + nao), + forms)); + } else { + ptail = list_collect(ptail, + cons(list(if3(atom(keys), eqfuncsym, memfuncsym), + tformsym, + list(quote_s, keys, nao), + nao), + forms)); + } } if (form && atom(form)) @@ -49312,6 +49312,24 @@ of these version values, the described behaviors are provided if is given an argument which is equal or lower. For instance .code "-C 103" selects the behaviors described below for version 105, but not those for 102. +.IP 156 +After version 156, a bug was fixed in the macro expander for +.codn caseq , +.code caseql +and +.codn casequal . +Selecting a compatibility value of 156 or less restores the buggy +behavior. The bug was that single-atom case keys were undergoing +evaluation. For instance +.code "(caseql x (a 0))" +would arrange for the evaluation of +.code a +as a variable, rather than treating it as the symbol +.code a +itself. Beside using the compatibility mechanism, a workaround is to +use a list of keys, exemplified by a rewrite of the foregoing +expression to +.codn "(caseql x ((a) 0))" . .IP 155 After version 155, the .code tok-str |