Using <> for opCmp

Don Clugston dac at nospam.com.au
Mon Nov 27 01:08:40 PST 2006


Lionello Lunesu wrote:
> "Stewart Gordon" <smjg_1998 at yahoo.com> wrote in message 
> news:ekcecj$iig$1 at digitaldaemon.com...
>> Lionello Lunesu wrote:
>> <snip>
>>> The thing is, <> already exists! It's doing too much at the moment: it 
>>> converts the int return value from opCmp to a boolean.
>> Exactly.  And that's indeed what I'd expect it to do.  Why do you feel 
>> that it's "too much"?
> 
> The original opCmp return value is lost, so currently <> is exactly the same 
> as != (except using opCmp instead of opEquals, I'd hope). 

Not quite.
x != y
is not the same as
x <> y
if x and y are reals (eg, x=2, y = real.nan:  x!=y is TRUE, but x <> y 
is FALSE).

I would expect that in the future there'd be an opUnorderedCmp(),
which the NCEG operators would use (As well as floating point, the NCEG 
operators could be used for tribools and SQL comparisions with NULL, for 
example).



More information about the Digitalmars-d mailing list