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

Source code maintainability [was: [RFC] Some more python and VimL interfaces]

Expand Messages
  • Roland Eggner
    Hi Bram! ... Please keep in mind: • Identifiers should tell for what purpose they have been created, otherwise the source code becomes unmaintainable. E.g.
    Message 1 of 42 , May 16, 2013
    • 0 Attachment
      Hi Bram!

      On 2013-05-15 Wednesday at 20:51 +0200 Bram Moolenaar wrote:
      >
      > ZyX wrote:
      >
      > [...]
      >
      > > >Would it be possible to have most Vim functions made callable from
      > > >Python this way? Obviously it's much better than using vim.eval().
      > >
      > > I assumed it be a convenience wrapper replacing
      > >
      > > vim.bindeval('function("bufnr")')('%')
      > >
      > > (obviously, you can save `vim.bindeval('function("bufnr")')` result in
      > > a variable) with a nicer syntax. I believe author of proposal assumed
      > > the same.
      >
      > Calling functions would be a very common thing. Thus I would keep the
      > name as short as possible: vim.f.bufnr('%')

      Please keep in mind:

      • Identifiers should tell for what purpose they have been created, otherwise
      the source code becomes unmaintainable. E.g. in the Linux kernel XFS module
      several function names are longer than 32 characters. Probably with reasons.
      And if you object, no user needs to type this function names: think of debugger
      sessions, think of grep commands in the source tree.

      • The age of punch cards is over. Nowadays the common 80 columns limit is just
      a habit without any technical reasons. Few people realized it, e.g. the Funtoo
      Linux Project has a coding standard with line length up to 160 characters.

      • Some people argue, short lines are convenient to read. Probably they don't
      understand the consequences of “use it or loose it” for their memory.

      --
      Regards
      Roland Eggner
    • Bram Moolenaar
      ... Yes, this also came up as a side effect of the os.chdir() solution. It s especially useful if a plugin can be distributed as a Python module plus some
      Message 42 of 42 , May 21, 2013
      • 0 Attachment
        Marc Weber wrote:

        > Yet another suggestion - what about adding &rtp to sys.path somehow ?
        > (with or without python version site-packages or the like)
        >
        > Then you could
        > - write .py files
        > - use them from python by
        >
        > import module
        > do_stuff()
        >
        > Yes - it can be trivially implemented in tools like vim-addon-manager,
        > but I'd prefer a global solution usable by everyone.

        Yes, this also came up as a side effect of the os.chdir() solution.

        It's especially useful if a plugin can be distributed as a Python module
        plus some lines in the Vim plugin. It would have a similar effect as
        using a Vim script under autoload.

        --
        A M00se once bit my sister ...
        "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/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.