patch 8.2.1473: items in a list given to :const can still be modified
Problem: Items in a list given to :const can still be modified.
Solution: Work like ":lockvar! name" but don't lock referenced items.
Make locking a blob work.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 079eecb..370964e 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -12262,10 +12262,18 @@
:const x = 1
< is equivalent to: >
:let x = 1
- :lockvar 1 x
+ :lockvar! x
< This is useful if you want to make sure the variable
- is not modified.
- *E995*
+ is not modified. If the value is a List or Dictionary
+ literal then the items also cannot be changed: >
+ const ll = [1, 2, 3]
+ let ll[1] = 5 " Error!
+< Nested references are not locked: >
+ let lvar = ['a']
+ const lconst = [0, lvar]
+ let lconst[0] = 2 " Error!
+ let lconst[1][0] = 'b' " OK
+< *E995*
|:const| does not allow to for changing a variable: >
:let x = 1
:const x = 2 " Error!