Hari Krishna Dara wrote:

> The :lockvar and :unlockvar commands fail when there is a recursive
> references. E.g., try the below:
> 
> :let a = {}
> :let b = {}
> :let a.b = b
> :let b:a = a
> :lockvar! a
> E743: variable nested too deep for (un)lock
> 
> You could of course end up with more complicated indirect recursive
> references as well, so it should guard against it.

Although it's correct as such, I know a trick to detect the same list or
dictionary is encountered a second time, and then don't recurse into it.

> Also, just noticed that string() fails as well.
> 
> :echo string(a)
> E724: variable nested too deep for displaying

This is much harder to avoid.  It's very well possible that a list or
dictionary appears multiple times without a recursive reference.  In
that case it should be listed normally.  It's not easy to distinguish a
normal reference from a recursive reference.

> There are probably others that would fail as well.

What others?

-- 
hundred-and-one symptoms of being an internet addict:
19. All of your friends have an @ in their names.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to