diff options
| author | Paul Eggert | 2020-04-19 15:09:02 -0700 |
|---|---|---|
| committer | Paul Eggert | 2020-04-19 15:12:05 -0700 |
| commit | e1d42da0d686e93534ee2abebe79bff95f18cb4d (patch) | |
| tree | 70f7d9b1fed7bf523a428cfa47c48ff0d27f3e43 /doc/lispref/objects.texi | |
| parent | 5805df74f5b919a3f67f3f7d31d6e600e1564e4e (diff) | |
| download | emacs-e1d42da0d686e93534ee2abebe79bff95f18cb4d.tar.gz emacs-e1d42da0d686e93534ee2abebe79bff95f18cb4d.zip | |
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.
Diffstat (limited to 'doc/lispref/objects.texi')
| -rw-r--r-- | doc/lispref/objects.texi | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 98b001afd2d..b45eb7ad8a4 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi | |||
| @@ -2395,17 +2395,19 @@ somewhere else. | |||
| 2395 | 2395 | ||
| 2396 | Although numbers are always constants and markers are always | 2396 | Although numbers are always constants and markers are always |
| 2397 | mutable, some types contain both constant and mutable members. These | 2397 | mutable, some types contain both constant and mutable members. These |
| 2398 | types include conses, vectors, and strings. For example, the string | 2398 | types include conses, vectors, strings, and symbols. For example, the string |
| 2399 | literal @code{"aaa"} yields a constant string, whereas the function | 2399 | literal @code{"aaa"} yields a constant string, whereas the function |
| 2400 | call @code{(make-string 3 ?a)} yields a mutable string that can be | 2400 | call @code{(make-string 3 ?a)} yields a mutable string that can be |
| 2401 | changed via later calls to @code{aset}. | 2401 | changed via later calls to @code{aset}. |
| 2402 | 2402 | ||
| 2403 | A program should not attempt to modify a constant because the | 2403 | Modifying a constant symbol signals an error (@pxref{Constant Variables}). |
| 2404 | A program should not attempt to modify other types of constants because the | ||
| 2404 | resulting behavior is undefined: the Lisp interpreter might or might | 2405 | resulting behavior is undefined: the Lisp interpreter might or might |
| 2405 | not detect the error, and if it does not detect the error the | 2406 | not detect the error, and if it does not detect the error the |
| 2406 | interpreter can behave unpredictably thereafter. Another way to put | 2407 | interpreter can behave unpredictably thereafter. Another way to put |
| 2407 | this is that mutable objects are safe to change, whereas constants are | 2408 | this is that although mutable objects are safe to change and constant |
| 2408 | not safely mutable: if you try to change a constant your program might | 2409 | symbols reliably reject attempts to change them, other constants are |
| 2410 | not safely mutable: if you try to change one your program might | ||
| 2409 | behave as you expect but it might crash or worse. This problem occurs | 2411 | behave as you expect but it might crash or worse. This problem occurs |
| 2410 | with types that have both constant and mutable members, and that have | 2412 | with types that have both constant and mutable members, and that have |
| 2411 | mutators like @code{setcar} and @code{aset} that are valid on mutable | 2413 | mutators like @code{setcar} and @code{aset} that are valid on mutable |