emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-27 e1d42da: Fix mutability glitches reported by Drew Adams


From: Paul Eggert
Subject: emacs-27 e1d42da: Fix mutability glitches reported by Drew Adams
Date: Sun, 19 Apr 2020 18:13:39 -0400 (EDT)

branch: emacs-27
commit e1d42da0d686e93534ee2abebe79bff95f18cb4d
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix mutability glitches reported by Drew Adams
    
    See Bug#40693#32.
    * doc/lispref/eval.texi (Self-Evaluating Forms, Backquote):
    Say that these yield constant conses, vectors and strings,
    not constant symbols.
    * doc/lispref/objects.texi (Constants and Mutability): Say that an
    attempt to modify a constant variable signals an error, instead of
    saying that it has undefined behavior.
---
 doc/lispref/eval.texi    |  8 ++++----
 doc/lispref/objects.texi | 10 ++++++----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index deb2889..f33c2fa 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -158,8 +158,8 @@ contents unchanged.
 @end group
 @end example
 
-  A self-evaluating form yields a constant, and you should not attempt
-to modify the constant's contents via @code{setcar}, @code{aset} or
+  A self-evaluating form yields constant conses, vectors and strings, and you
+should not attempt to modify their contents via @code{setcar}, @code{aset} or
 similar primitives.  The Lisp interpreter might unify the constants
 yielded by your program's self-evaluating forms, so that these
 constants might share structure.  @xref{Constants and Mutability}.
@@ -704,8 +704,8 @@ Here are some examples:
 @end example
 
 If a subexpression of a backquote construct has no substitutions or
-splices, it acts like @code{quote} in that it yields a constant that
-should not be modified.
+splices, it acts like @code{quote} in that it yields constant conses,
+vectors and strings that should not be modified.
 
 @node Eval
 @section Eval
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index 98b001a..b45eb7a 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -2395,17 +2395,19 @@ somewhere else.
 
   Although numbers are always constants and markers are always
 mutable, some types contain both constant and mutable members.  These
-types include conses, vectors, and strings.  For example, the string
+types include conses, vectors, strings, and symbols.  For example, the string
 literal @code{"aaa"} yields a constant string, whereas the function
 call @code{(make-string 3 ?a)} yields a mutable string that can be
 changed via later calls to @code{aset}.
 
-  A program should not attempt to modify a constant because the
+  Modifying a constant symbol signals an error (@pxref{Constant Variables}).
+A program should not attempt to modify other types of constants because the
 resulting behavior is undefined: the Lisp interpreter might or might
 not detect the error, and if it does not detect the error the
 interpreter can behave unpredictably thereafter.  Another way to put
-this is that mutable objects are safe to change, whereas constants are
-not safely mutable: if you try to change a constant your program might
+this is that although mutable objects are safe to change and constant
+symbols reliably reject attempts to change them, other constants are
+not safely mutable: if you try to change one your program might
 behave as you expect but it might crash or worse.  This problem occurs
 with types that have both constant and mutable members, and that have
 mutators like @code{setcar} and @code{aset} that are valid on mutable



reply via email to

[Prev in Thread] Current Thread [Next in Thread]