Reply to message «Re: question about string expression evaluation / bug?», sent 22:07:10 23 May 2011, Monday by hsitz:
> Still wondering about the issue with different values for my empty > string comparison, though. Seems like it must be a bug in either > design or implementation of 'ignorecase'. I wonder whether with > 'ignorecase' set the expression: 'abc' > '' returns 0 on 64-bit vim > and 1 on 32-bit. . . I guess it's time to post this to vim-dev as a bug since we managed to deduce conditions under which it is reproduced. I personally can say that I was able to reproduce it on vim-7.3.198 (--with-features=huge --enable-perlinterp --enable- tclinterp --enable-luainterp --enable-rubyinterp --enable-python3interp, revision f0cc719cd129) and vim-7.3.189 (USE='X acl bash-completion cscope gpm nls perl python ruby vim-pager -debug -minimal') from gentoo repos on amd64. Original message: > On May 23, 8:12 am, hsitz <[email protected]> wrote: > > > This is a reason why I never use `==', `!=', `>', `>=', `<', `<=' for > > > comparing strings, only `is'/`isnot' (it looks better then `==#' and > > > `!=#') and operators with either `?' or `#' at the end. > > Zyx -- I didn't even realize 'is'/'isnot' were defined for strings. > However, it seems that they are equivalent to '==' and '!=' and not > the matchcase operators you suggest. From the docs: > "the original |List|. When using "is" without a |List| it is > equivalent to > using "equal", using "isnot" equivalent to using "not equal". Except > that a > different type means the values are different. "4 == '4'" is true, "4 > is '4'" > is false." > > E.g., > > :set ignorecase > :echo 'abc' is 'ABC' (output is 1) > :echo 'abc' == 'ABC' (output is 1) > :echo 'abc' ==# 'ABC' (output is 0) > > Your point about specifying matchcase or ignorecase expressly is a > good one. I will be modifying my code to do that. > > Still wondering about the issue with different values for my empty > string comparison, though. Seems like it must be a bug in either > design or implementation of 'ignorecase'. I wonder whether with > 'ignorecase' set the expression: 'abc' > '' returns 0 on 64-bit vim > and 1 on 32-bit. . . > > -- Herb > > > Zyx -- Thanks very much, I think you're onto something. > > > > However on my machine the two expressions you give above both evaluate > > to 1. What is the explanation for the difference?: > > ------------------------------------------ > > :echo 'DONE' ># '' > > 1 > > > > :echo 'DONE' >? '' > > > > 1 > > ----------------------------------------
signature.asc
Description: This is a digitally signed message part.
