On Mon, Jun 25, 2018 at 12:06:15AM +0200, Bram Moolenaar wrote:
> 
> James McCoy wrote:
> > eval_expr_to_bool() handles numbers just fine.  Why make supplying a
> > number for the skip argument a hard error instead of simply evaluating
> > it to a boolean?
> > 
> > The documentation had already stated that evaluation of the skip
> > argument "should return non-zero if this match is to be skipped".
> > 
> > The general reporting of errors instead of ignoring them is definitely
> > useful, but it seems like there was indeed a bug in that a number was
> > considered an error.
> 
> Passing the number zero made the function return right away:
> 
>       skip = &argvars[4];
>       if (skip->v_type != VAR_FUNC && skip->v_type != VAR_PARTIAL
>           && skip->v_type != VAR_STRING)
>         {
>           goto theend;
>       }
> 
> Thus it silently always failed.

Yes, I understand that.  Making the user use "0" instead of 0 is just an
annoyance.  By allowing a number here (and in do_searchpair), this code
becomes consistent with other places that use eval_expr_to_bool().  It
also means that the change isn't backwards incompatible.

Cheers,
-- 
James
GPG Key: 4096R/91BF BF4D 6956 BD5D F7B7  2D23 DFE6 91AE 331B A3DB

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