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".

Reply via email to