diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2023-04-14 18:26:27 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2023-04-14 19:34:23 +0200 |
commit | c60b59e04c3776a90adaa8c8fe53af3075a833b8 (patch) | |
tree | 55b5586eee1749ef451982b5edcf4f65666d0b9c /etc | |
parent | dc842a71ed035dab1115f2e67d35dd07410e18be (diff) | |
download | emacs-c60b59e04c3776a90adaa8c8fe53af3075a833b8.tar.gz |
Disallow creation of circular variable alias chains
Make `defvaralias` signal an error upon attempts to create variable
alias cycles. This detects errors earlier and makes the alias
traversal during execution simpler and faster since no cycle detection
is needed elsewhere.
Now variable and function aliases are handled identically in these
respects.
* src/lisp.h (indirect_variable): Remove declaration.
* src/data.c (indirect_variable): Remove.
(Findirect_variable): Update doc string. Simplify alias resolution.
(Fboundp, find_symbol_value, set_internal, default_value)
(set_default_internal, Fmake_variable_buffer_local)
(Fmake_local_variable, Fkill_local_variable, Flocal_variable_p)
(Flocal_variable_if_set_p, Fvariable_binding_locus):
* src/buffer.c (buffer_local_value):
* src/eval.c (specbind): Simplify variable alias resolution.
(Fdefvaralias): Update doc string. Check for cycles.
* doc/lispref/variables.texi (Variable Aliases):
Mention that `defvaralias` can signal `cyclic-variable-indirection`
but `indirect-variable` cannot.
* etc/NEWS: Announce the change.
* test/src/eval-tests.el (eval-tests-defvaralias): New test.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/NEWS | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -480,19 +480,19 @@ so it will return the remote UID for remote files (or -1 if the connection has no associated user). +++ -** 'fset' and 'defalias' now signal an error for circular alias chains. -Previously, 'fset' and 'defalias' could be made to build circular -function indirection chains as in +** 'fset', 'defalias' and 'defvaralias' now signal an error for cyclic aliases. +Previously, 'fset', 'defalias' and 'defvaralias' could be made to +build circular function and variable indirection chains as in (defalias 'able 'baker) (defalias 'baker 'able) -but trying to call them would often make Emacs hang. Now, an attempt +but trying to use them would sometimes make Emacs hang. Now, an attempt to create such a loop results in an error. -Since circular alias chains now cannot occur, 'function-alias-p' and -'indirect-function' will never signal an error. Their second -'noerror' arguments have no effect and are therefore obsolete. +Since circular alias chains now cannot occur, 'function-alias-p', +'indirect-function' and 'indirect-variable' will never signal an error. +Their 'noerror' arguments have no effect and are therefore obsolete. * Changes in Emacs 30.1 on Non-Free Operating Systems |