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

Re: exists("*Foo!garbage") = 1 ?

Expand Messages
  • Benji Fisher
    ... I tried ... and found that there are 111 matches. If all we are worried about is exists( * ) where contains non- isk characters, then I
    Message 1 of 9 , May 1, 2006
      On Tue, May 02, 2006 at 12:13:37AM +0200, Bram Moolenaar wrote:
      >
      > Charles Campbell wrote:
      >
      > > Bram Moolenaar wrote:
      > >
      > > >The problem of changing something like this is that all scripts that are
      > > >included in the release need to be checked for effects. And there are
      > > >lots of scripts now. I wouldn't be surprised if, for example, the netrw
      > > >plugin stops working properly.
      > >
      > > In perusing netrw, I believe that all the netrw usages of
      > > exists("*func") give exists() a full function
      > > name; ie. they don't depend on its just being a prefix. So, I expect
      > > that netrw should work ok with
      > > such a change.
      >
      > Bad example... I meant that there are scripts that are too big to
      > check.

      I tried

      :vimgrep /exists[^)]*\*/ $VIMRUNTIME/**/*.vim
      :cl

      and found that there are 111 matches. If all we are worried about is
      exists("*<string>") where <string> contains non-'isk' characters, then I
      am willing to check them. I bet there are very few.

      HTH --Benji Fisher
    • Srinath Avadhanula
      Hi all, ... Thanks Benji for doing this. After Bram mentioned netrw.vim yesterday, I took a look at where all it uses exists( *fun ) and it looks like
      Message 2 of 9 , May 1, 2006
        Hi all,

        On 5/1/06, Benji Fisher <benji@...> wrote:
        > On Tue, May 02, 2006 at 12:13:37AM +0200, Bram Moolenaar wrote:
        > >
        > > Bad example... I meant that there are scripts that are too big to
        > > check.
        >
        > I tried
        >
        > :vimgrep /exists[^)]*\*/ $VIMRUNTIME/**/*.vim
        > :cl
        >
        > and found that there are 111 matches. If all we are worried about is
        > exists("*<string>") where <string> contains non-'isk' characters, then I
        > am willing to check them. I bet there are very few.
        >

        Thanks Benji for doing this. After Bram mentioned netrw.vim yesterday,
        I took a look at where all it uses exists('*fun') and it looks like
        netrw.vim might also be bitten by the same bug which is troubling me...

        In netrwfilehandlers.vim, line 32 is

        if a:exten != "" && exists("*s:NFH_".a:exten)

        so if the user is for some reason looking at a file which has non-'isk'
        characters in its extension (for example, CVS ",v" files), then the
        above will fail. I cannot generate a test case which fails because it
        looks like netrw.vim automatically invokes rundll32,FileProtocolHandler
        when has('win32'), however, the following call:

        call netrwFileHandlers#Invoke('png,v', 'file.png')

        produces the expected error (instead of just failing gracefully):

        --------------------------------%<--------------------------------
        Error detected while processing function netrwFileHandlers#Invoke:
        line 5:
        E121: Undefined variable: s:NFH_png
        E15: Invalid expression: s:NFH_png,v("transmission4bar.png")
        --------------------------------%<--------------------------------

        I think this is another argument in favor of fixing bugs and letting
        unintended behavior produce bugs rather than work for "mysterious"
        reasons.

        Thanks,
        Srinath
      • Bram Moolenaar
        ... The point is that the past year we have been testing everything with the way it works now. If this is changed then we have to make sure that there is not
        Message 3 of 9 , May 2, 2006
          Benji Fisher wrote:

          > On Tue, May 02, 2006 at 12:13:37AM +0200, Bram Moolenaar wrote:
          > >
          > > Charles Campbell wrote:
          > >
          > > > Bram Moolenaar wrote:
          > > >
          > > > >The problem of changing something like this is that all scripts that are
          > > > >included in the release need to be checked for effects. And there are
          > > > >lots of scripts now. I wouldn't be surprised if, for example, the netrw
          > > > >plugin stops working properly.
          > > >
          > > > In perusing netrw, I believe that all the netrw usages of
          > > > exists("*func") give exists() a full function
          > > > name; ie. they don't depend on its just being a prefix. So, I expect
          > > > that netrw should work ok with
          > > > such a change.
          > >
          > > Bad example... I meant that there are scripts that are too big to
          > > check.
          >
          > I tried
          >
          > :vimgrep /exists[^)]*\*/ $VIMRUNTIME/**/*.vim
          > :cl
          >
          > and found that there are 111 matches. If all we are worried about is
          > exists("*<string>") where <string> contains non-'isk' characters, then I
          > am willing to check them. I bet there are very few.

          The point is that the past year we have been testing everything with the
          way it works now. If this is changed then we have to make sure that
          there is not a new problem anywhere.

          Also keep in mind that scripts sometimes contain bugs that are not
          discovered until something seemingly harmless is changed in how Vim
          behaves.

          But if you are willing to carefully inspect all places where exists() is
          used and make sure that this change will not cause any problem then I
          might reconsider. If you make a mistake and we find a bug anyway than
          you will be severely punished (we'll send the Spanish inquisition)!

          --
          DENNIS: Look, strange women lying on their backs in ponds handing out
          swords ... that's no basis for a system of government. Supreme
          executive power derives from a mandate from the masses, not from some
          farcical aquatic ceremony.
          "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

          /// Bram Moolenaar -- Bram@... -- 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 ///
        Your message has been successfully submitted and would be delivered to recipients shortly.