diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-08-17 21:07:22 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-08-17 21:07:22 +0200 |
commit | 021bda56710d98c09a6b35610a476ab2dd8c58ad (patch) | |
tree | ef1e8f444ad876989fde5d1ae961805642cfa9de /runtime | |
parent | 7b22117c4ecf383b6f35acef041773a83ec28220 (diff) | |
download | vim-git-021bda56710d98c09a6b35610a476ab2dd8c58ad.tar.gz |
patch 8.2.1473: items in a list given to :const can still be modifiedv8.2.1473
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.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 079eecb92..370964e56 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -12262,10 +12262,18 @@ text... :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! |