Olaf Dabrunz wrote:

> Example:
> 
>     :let d = {'a': 99, 'b': 100}
>     :lockvar 1 d
>     :call extend(d, {'a': 123})
>         E741: Value is locked: extend() argument
>     :let d.a = 123
>     :let d
>         d                     {'a': 123, 'b': 100}
> 
> The dictionary is locked, but the 'a' item is not, so extend() on 'a'
> should succeed in the same way as the 'let' does. According to ':he
> lockvar', a dictionary lock protects against item deletion and addition,
> but not against changing an existing item.

Hmm, one could argue that extend() adds the new key/value pair, thus
that it should fail.

Zyx's argument that it may change one existing key/value but then fail
on a following one that adds a key makes sense.  Perhaps we should just
state "extend() on a locked list or dict does not work". 

-- 
I learned the customs and mannerisms of engineers by observing them, much the
way Jane Goodall learned about the great apes, but without the hassle of
grooming.
                                (Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui