On Wed, Jun 24, 2009 at 01:35:25PM -0400, John Macdonald wrote:
> On Tue, Jun 23, 2009 at 07:51:45AM +1000, Damian Conway wrote:
> > Perl 6's approach to xor is consistent with the linguistic sense of
> > 'xor' ("You may have a soup (x)or a salad (x)or a cocktail"), [ ... ]
> 
> That choice tends to mean "exactly one", rather than "the first one
> the waiter hears".  (A good waiter will explain the choice limitation
> at the time the order is made rather than having to deal with it
> being escalated to a complaint when the "missing" item is demanded.)
> 
> Which means that short-circuiting is not right here - it must
> go through the entire list to determine whether there are zero
> true selections, find the first of exactly one true selections,
> or die if there are more than one true selections.  The only valid
> short-circuiting would be to die at the second true value without
> needing to check whether there are any more - it is already an
> invalid response and there is no need to figure just how badly
> invalid it is.  But for any non-error response, no short circuiting
> is possible for (brace yourselves) "the one true response style"
> any more than it is for "the odd count response style".

And when "or" does not mean "exactly one" it means "any subset you
wish", which again doesn't provide a lot of use for short circuiting.
The only case where short circuiting has any utility is for testing
whether any of the alternatives were selected while not caring
which other might have been also selected.

I'm not too concerned about what meaning is chosen for "xor"
(although if it is anything other than "and odd number" I'll probably
use it wrong a bunch of times but not often enough to learn better -
I'm a computer scientist and I've known what xor means for a long
enough time to not think about it meaning something else, but I
don't use it very often outside of job interviews :-).

Reply via email to