Loading ...
Sorry, an error occurred while loading the content.

38880Re: New snapshot 7.0046

Expand Messages
  • Johnny Blaze
    Feb 1 5:21 AM
    • 0 Attachment
      On Tue, 01 Feb 2005 10:55:33 +0100, Bram Moolenaar <Bram@...> wrote:
      >
      > Johnny Blaze wrote:
      >
      > > On Mon, 31 Jan 2005 23:08:57 +0100, Bram Moolenaar <Bram@...> wrote:
      > > >
      > > > I just sent out a new snapshot. Several problems were fixed.
      > > >
      > > > New feature: variable locking.
      > > >
      > > > :lockvar {name} locks a variable
      > > > :unlockvar {name} unlocks a variable
      > > > islocked() checks if a variable or value is locked.
      > >
      > > Bram,
      > >
      > > There is something hinky going on with the locking. I'll paraphrase
      > > the script I'm working with:
      >
      > It's possible that there are still a few places where the lock flag
      > isn't initialized properly. It's hard to find all the spots.
      >
      > > let s:dirty = { 'file': 0, 'menu': 0 }
      > >
      > > fun Read()
      > > let s:dirty.menu = 1
      > > endfun
      > >
      > > fun CheckState()
      > > if s:dirty.menu
      > > let s:dirty.menu = 0
      > > endif
      > > endfun
      > >
      > > call Read()
      > > call CheckState()
      > >
      > > At 'call Read()' islocked("s:dirty") == 0 and islocked("s:dirty.menu") == 0
      > > At 'call CheckState()' islocked("s:dirty") == 0 and
      > > islocked("s:dirty.menu") == 1
      >
      > Not for me. Must be a missing initialisation. Try this change:
      >
      > *** eval.c~ Mon Jan 31 17:56:07 2005
      > --- eval.c Tue Feb 1 10:27:42 2005
      > ***************
      > *** 2211,2216 ****
      > --- 2211,2217 ----
      > else
      > {
      > *lp->ll_tv = *rettv;
      > + lp->ll_tv->v_lock = 0;
      > init_tv(rettv);
      > }
      > }
      >

      Thanks Bram, It works just fine now.

      > > if I am stepping through the script and before "let s:dirty.menu = 0"
      > > in CheckState() I execute :unlockvar s:dirty.menu, I get "E742: Cannot
      > > change value of s:dirty.menu = 0"
      >
      > That means a flag is set that is used for function arguments. You can't
      > reset it with ":unlockvar". Again sounds like missing initialisation.

      so in nomal practice, if a locked variable is found, unlockvar will be
      able to unlock it?
      --

      . o O pyromancer O o .
    • Show all 5 messages in this topic