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

38871Re: New snapshot 7.0046

Expand Messages
  • Johnny Blaze
    Jan 31, 2005
    • 0 Attachment
      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.


      There is something hinky going on with the locking. I'll paraphrase
      the script I'm working with:

      let s:dirty = { 'file': 0, 'menu': 0 }

      fun Read()
      let s:dirty.menu = 1

      fun CheckState()
      if s:dirty.menu
      let s:dirty.menu = 0
      end if

      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
      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"

      If I source it without unlockvar, I get "E741: Value is locked: s:dirty.menu"

      My questions are, s:dirty or any of its members is never passed as an
      argument. Why would vim lock it? and why isn't unlockvar doing what
      its supposed to do?



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