Re: Bug in :(un)lockvar
Hari Krishna Dara wrote: I need to create a doubly linked list and since this will cause problem with lockvar, I will just comment the lock/unlockvar commands. I am wondering if you have any plans to fix this issue. The lockvar is a great way to prevent accidental changes (and it already helped me once) so I would rather not comment it. Fixing lockvar for recursive references is in the todo list. -- If Pacman had affected us as kids we'd be running around in dark rooms, munching pills and listening to repetitive music. -- Marcus Brigstocke /// 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///
Re: Bug in :(un)lockvar
Bram, I need to create a doubly linked list and since this will cause problem with lockvar, I will just comment the lock/unlockvar commands. I am wondering if you have any plans to fix this issue. The lockvar is a great way to prevent accidental changes (and it already helped me once) so I would rather not comment it. -- Thank you, Hari On Sat, 7 Oct 2006 at 5:56pm, Hari Krishna Dara wrote: On Sat, 7 Oct 2006 at 3:32pm, Bram Moolenaar wrote: 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. Does that mean you will provide a patch? Also note that it could be a self recursion too (:let a.a = a). 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. Why is it hard to distinguish a direct reference and indirect reference? In any case, this functionality is not much of a use unless you really want to be able to restore the original structure using eval(), but I doubt if string() has special semantics to preserve identities. There are probably others that would fail as well. What others? I just meant there could be others, but I looked at the list there shouldn't be any others. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: Bug in :(un)lockvar
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///
Bug in :(un)lockvar
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. Also, just noticed that string() fails as well. :echo string(a) E724: variable nested too deep for displaying There are probably others that would fail as well. -- Thanks, Hari __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com