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

Re: patch: ':let a="+10"' etc

Expand Messages
  • Bram Moolenaar
    ... So long as you pass only 20 or -20 it will work. I don t see where a +20 would come from, unless you typed it somewhere. In that case you just
    Message 1 of 7 , Jan 31, 2001
    • 0 Attachment
      Neil Bird wrote:

      > IIUC, what we have is the situation where every variable/literal is
      > basically a string. Then, in some circumstances if you're lucky, the
      > strings may be interpreted as numbers. Is that fair?

      So long as you pass only "20" or "-20" it will work. I don't see where a
      "+20" would come from, unless you typed it somewhere. In that case you just
      shouldn't have typed it.

      > So, would it be more helpful if there was a (say) 'eval()' function that
      > did it's utmost to interpret and evaluate a string as a number (e.g.,
      > "eval( '1+(--3)++2' )" sort of thing)?

      This did come up in another discussion too. The conclusion there was that "it
      would be nice if" we had some expression evaluation of a string, and the
      result then again used in an expression. Works like backticks in a shell
      command. The problem is that it's not so easy to implement. And since using
      ":exe" will do it too, in a more verbose way, it's not really needed.

      I'm trying to steer away from changes that "would be nice" or "make the Vim
      script look better". Otherwise Vim 6.0 will never be finished!

      > In the same vein, anything not numeric would be interpreted as '0' (?)

      Instead of causing an error message, yes.

      From "know your smileys":
      [:-) Frankenstein's monster

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
      \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
    Your message has been successfully submitted and would be delivered to recipients shortly.