actually, foo returns an Object, so it would have to be !((boolean)foo()) i guess, which i would have written if it was my code. my guess is that the original implementer wanted to avoid casting? but the thought processes of the one who wrote foo are a mystery, too.

EvanED wrote:Because <> is actually used by a couple languages but I've not seen any that use ><?

There are some flavours of BASIC that will accept >< (and also =< and => in place of <= and >=)... But still, I agree that, by its construction, <> implies "is less or greater than", which is only really equivalent to "not equal" if the type is totally ordered (and thus the trichotomy holds). If the type isn't totally ordered (or ordered at all) then you can have a<b and a>b both be false (or type errors) but a<>b be true.

actually, foo returns an Object, so it would have to be !((boolean)foo()) i guess, which i would have written if it was my code. my guess is that the original implementer wanted to avoid casting? but the thought processes of the one who wrote foo are a mystery, too.

Oh... that's weird. In that case I'd probably go with !foo(bar).equals(true) (I think autoboxing figures that out, but it's been a couple years so I might be mistaken). Mostly because most people put their constants on the right hand side of the operator, so it seems a little less backwards. I wouldn't cast it without ensuring that it's a Boolean first, and doing that check just to use it in .equals seems like a waste since .equals should do the check for you anyways. If it *always* returns a Boolean, and is called often enough, I might just wrap it and make the wrapper return [bB]oolean.

I'm partial to != not because I think it's logical, but because it doesn't really have any other meanings assigned to it that can get mixed up with the intended meaning.

That's the real reason (I think) why the != for inequality, == for equality, := for assignment makes sense. None of these is likely to get confused with something else.

Or, y'know, we could use <> for inequality, <- to read the next line from a file, = for equality testing, < to assign, > for greater-than, -lt for less than, <= for less than or equal to, and -ge for greater than or equal to.

And while we're at it let's use ^ for pointers, * for exponentiation, and x for multiplication. Then we can use + for concatenation, - for logical inverse, # for addition, v for OR, and /\ for AND. Yay!