From 4e3283706f66e0312c4b2ff34a1f3d14f66278df Mon Sep 17 00:00:00 2001 From: Kris Katterjohn Date: Tue, 27 Jun 2017 18:46:55 -0500 Subject: [PATCH] No longer allow PROGV to bind constants PROGV was allowed to bind constants in the C-compiler and the bytecode compiler and interpreter, but the behavior would differ between them: > (defun foo () (flet ((memq (item list) (member item list :test #'eq))) (progv (list :test) (list :test-not) (memq 'bar '(bar baz quux))))) FOO > (foo) (BAZ QUUX) > (compile 'foo) FOO > (foo) (BAR BAZ QUUX) CLHS says the behavior is undefined when attempting to bind or assign constant variables (CLHS 3.1.2.1.1.3 and the entry for defconstant). The C-compiler and bytecode compiler and interpreter give errors when attempting to bind or assign constant variables in lambda expressions, LET, SETQ and various other binding/assignment forms. So the behavior above in PROGV is inconsistent. Now give an error when attempting to bind a constant variable in PROGV in the C-compiler and the bytecode compiler and interpreter. --- src/c/stacks.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c/stacks.d b/src/c/stacks.d index 2e0c15913..2ea422038 100644 --- a/src/c/stacks.d +++ b/src/c/stacks.d @@ -198,7 +198,7 @@ ecl_progv(cl_env_ptr env, cl_object vars0, cl_object values0) return n; } else { cl_object var = ECL_CONS_CAR(vars); - if (!ECL_SYMBOLP(var)) + if (!ECL_SYMBOLP(var) || (ecl_symbol_type(var) & ecl_stp_constant)) FEerror("Not a valid variable name ~S.", 1, var); if (Null(values)) { ecl_bds_bind(env, var, OBJNULL);