mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-23 04:52:42 -08:00
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.
This commit is contained in:
parent
c9e7326275
commit
4e3283706f
1 changed files with 1 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue