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

50451Re: Floating point syntax

Expand Messages
  • Bram Moolenaar
    Jun 4, 2008
    • 0 Attachment
      Ben Schmidt wrote:

      > The earlier thread where Bram asked for comments on floating point
      > syntax, after quite a few suggestions were made and rejected for
      > compatibility reasons, petered out. However, two proposals were made
      > that I think had merit, and I wonder if people have additional comment
      > on them, and perhaps may see them if part of a new thread!
      >
      > The first proposal was mine:
      >
      > - I pointed out that there is actually possibly ambiguity in the current
      > syntax unless a float is required to have a decimal point or exponent,
      > as &123.456 could mean float 123.456 or float 123 (123.0) concatenated
      > with integer 456. If the requirement is added, the ambiguity is
      > removed, but &123 is invalid, which is a bit of a shame.

      The "." operator only works on strings. There is no automatic
      conversion of a float to a string, so a "." after a float is invalid.
      And with a single "." it's part of the float, no matter what follows.

      > - I proposed an alternative syntax that I prefer and I think is likely
      > to be more robust in the long run: enclosing floats in curly braces.
      > E.g. {123.456}. Specifically, a set of curly braces would be taken to
      > represent a float if and only if it is (1) not preceded by a valid
      > variable name character and (2) contains a valid float. Nobody came up
      > with any reason this would not work.

      It would work, but I think &123.456 looks better than {123.456}. And we
      might want to use {} for something else (if possible, since it's already
      used for curly-braces-names).

      > The second was a proposal to represent floats as numbers with decimal
      > points but no additional punctuation which was implicit in this report
      > from Ilya Bobir:
      >
      > - I did a search for vim scripts that use concatenation operation
      > between two numbers without interleaving space. It appears that
      > Google Code Search was able to find only 39 matches and all were
      > false positives.
      >
      > Nobody gave any reply to the message.

      I wonder how you do that search. And if you manage to come up with the
      right pattern, what the number of matches actually means.

      > I would like to note, though, that this doesn't solve the problem for
      > exponent notation. However, I suspect a search of vim scripts containing
      > numbers of that form would yield even less results, though I have not
      > tried it. The search also doesn't take into account expressions that may
      > be built dynamically in vim scripts rather than being hard coded, but
      > again, I doubt many if any of these exist.
      >
      > I personally would prefer either of these syntaxes to the notation with
      > the ampersand.
      >
      > Do people have further comments/thoughts on this? Is Bram still
      > interested in hearing them?

      Yes, but most people appear to be OK with the &123.456 syntax. Thus if
      you want something else, you need to come up with good arguments.

      > The earlier thread which contains more details can be read here:
      >
      > http://groups.google.com/group/vim_dev/browse_thread/thread/1c8806e536ec12cd
      >
      > The relevant posts are at the end. The last 7 or so, which happen to
      > nicely form the second page of posts at present.

      --
      It doesn't really matter what you are able to do if you don't do it.
      (Bram Moolenaar)

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

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 15 messages in this topic