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. -- Thanks, Hari __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com