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

75665Re: [patch] doc/eval.txt: add "g:" to :function description

Expand Messages
  • Bram Moolenaar
    Mar 16 11:52 AM
    • 0 Attachment
      Nikolay Pavlov wrote:

      > On Mar 16, 2014 6:09 PM, "Bram Moolenaar" <Bram@...> wrote:
      > >
      > >
      > > Cade Forester wrote:
      > >
      > > > diff -r f99b6efb5193 runtime/doc/eval.txt
      > > > --- a/runtime/doc/eval.txt Wed Mar 12 21:28:26 2014 +0100
      > > > +++ b/runtime/doc/eval.txt Sun Mar 16 13:16:10 2014 +0700
      > > > @@ -6624,7 +6624,7 @@
      > > > :fu[nction][!] {name}([arguments]) [range] [abort] [dict]
      > > > Define a new function by the name {name}. The
      > name
      > > > must be made of alphanumeric characters and '_',
      > and
      > > > - must start with a capital or "s:" (see above).
      > > > + must start with a capital, "g:" or "s:" (see
      > above).
      > > >
      > > > {name} can also be a |Dictionary| entry that is a
      > > > |Funcref|: >
      > >
      > > When "g:" is used the name must still start with a capital. It has no
      > > effect though, without "g:" the function is also global.
      >
      > ? It does not have to. The current implementation allows function to
      > *contain colon*. OP is wrong: not "start with g:", but "contain colon on
      > any position except for the start of the name". And if function name
      > contains anything except for alphanumeric characters and underscore (i.e.
      > colon, hash and SNR) it no longer has to start with capital letter. E.g.
      > the following code runs fine:
      >
      > function abc:def()
      > return 1
      > endfunction
      > echo abc:def()
      >
      > g: falls under *this* rule, it has absolutely nothing to do with variable
      > scope.

      That's a bug. A function name should not be allowed to contain a colon.
      The intention, as mentioned in the quoted docs, is only alphanumeric
      characters and '_', while prepending s: is allowed to make the function
      script-local. Something like abc:def() was never intended to work.

      --
      (letter from Mark to Mike, about the film's probable certificate)
      I would like to get back to the Censor and agree to lose the shits, take
      the odd Jesus Christ out and lose Oh fuck off, but to retain 'fart in
      your general direction', 'castanets of your testicles' and 'oral sex'
      and ask him for an 'A' rating on that basis.
      "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/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • Show all 5 messages in this topic