You say it "worked fine" no doubt because you understand what's happening and the behavior makes sense to you. The manual added this "warning" to make users aware of the behavior; that's all. If you understand the behaver, so that you expect what in fact happens, then all is well.
I don't agree with the manual's wording, FWIW.
Instead of saying that you "shouldn't" do this, it should instead just point out what happens, and then advise you against doing that in general, i.e., to do that only if (1) you understand what it does and (2) for some reason you want it to do that.
There should be almost no uses of the word "should" in the manuals. Instead, there should be explanation of what's going on - the consequences of doing XYZ.
As for why the manual says this? I think it's just trying to point out, besides the general advice that you likely don't want to modify something that can be considered by Emacs as a constant, that sometimes it might not be so obvious that something might be considered by Emacs as a constant.
The blanket statement about eval
is not correct or sufficient, IMHO. But the intent of this doc is to save you trouble by inadvertently modifying a "constant". In particular, the doc rightly wants to make you aware that '(some list)
is not handled the same by the interpreter and byte compiler as, say (list 'some 'list)
. And that even cases like the example shown can get you into trouble.
Now, whether you want such behavior/trouble is up to you.
Evaluating (list 'quote x)
with x
being the list (0.5)
evaluates to the list (quote (0.5))
, and evaluating that list gives the "constant" list (0.5)
.
That is, that list could be a "constant", i.e., considered "immutable". Those terms really mean that the list structure is likely something you don't want to modify, because the result is, as @zwol said, undefined.
This is just a roundabout case of creating a list by quoting it, e.g., '(0.5)
, and Elisp likes to be able to consider such a result as constant.