On Thu, 2 Jul 2009, TSa wrote: > Martin D Kealey wrote: > > This solves both the human expectation ("Would you like wine or beer or > > juice?" "Beer and juice please" "Sorry...") and the associativity > > problem: (a ^^ b) ^^ (c ^^ d) == a ^^ (b ^^ (c ^^ d)). > > I don't understand how the associativity problem is solved when we > use unthrown exceptions to implement the one of n xor. The expression > True && True && True is False without parens but (True && True) && True > evaluates to True
Assuming you meant "^^" rather than "&&", then under my proposal, that's not the case. In particular, True ^^ True evaluates to TooManyException. If that exception is implicitly thrown, then that's what you get from the whole expression. If not, TooManyException ^^ Anything doesn't evaluate the right operand at all, and returns the value of the left operand. So you'd get the same answer regardless of whether you put brackets in or not. -Martin