Unary + and unary - are accepted as operators for Numbers in
vimscript. Floats are not expressly mentioned under ":help expr7" but
I would expect them to be "some kind of number", thus + 1.2 should be
a legitimate expression (1.2, unchanged) and so would - 1.2 (1.2, with
sign change). These expressions would of course be subject to operator
precedence. In particular 1.2 is an atomic Float (an expr9) and so is
-1.2 (with no space), but - 1.2 (with space) is an expr7.

Best regards,
Tony.

On Wed, Dec 21, 2016 at 6:17 PM, Pavol Juhas <[email protected]> wrote:
> On Wed, Dec 21, 2016 at 12:05 PM, Dominique Pellé
> <[email protected]> wrote:
> ...
>> I also think that it's odd to accept spaces between the
>> sign and the digits.  However, Vim already accepts spaces
>> after the - sign and not after the + sign  (inconsistency addressed
>> in patch in this thread).   If we instead give an error for
>> str2float(" + 1.2"), then we break compatibility and potentially
>> break existing scripts.
>
> True, but whichever script is relying on "+ 1.2" being a legitimate
> float is already
> buggy and fragile, because it breaks for "- 1.2".  I don't see there
> would be much
> damage caused by requiring attached signs.
>
> Pavol
>
> --
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui