ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <jesse.gl...@oracle.com>
Subject Re: xor condition
Date Wed, 20 Jul 2011 10:44:47 GMT
On 07/16/2011 08:59 PM, Matt Benson wrote:
> xor(true, false) == true
> xor(true, false, true) == false
> xor(true, false, true, false) == false
>
> Is this correct?

Follows the usual semantics; cf.: http://en.wikipedia.org/wiki/Exclusive_or#Associativity_and_commutativity

> It would seem that semantically an xor over multiple
> nested conditions should mean that exactly one value should evaluate
> true in order for the xor operation to yield truth.

Which is in fact the case in the examples you mentioned, but probably you are thinking of

xor(true, true, true) == true

which is consistent with the algebraic definition, and the behavior of Java's ^ operator for
that matter. If you wanted a condition with the semantics you describe, it 
should be named something else.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message