On Mon, Jun 22, 2009 at 4:12 PM, Minimiscience<minimiscie...@gmail.com> wrote: > On Jun 22, 2009, at 5:51 PM, 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"), and also >> with the IEEE 91 standard for logic gates. > > I don't think natural language -- especially the abomination that is English > -- is the best guide for understanding logical operations (why, yes, I *do* > speak Lojban; how did you know?). As for consistency, Perl 6's bitwise > exclusive-or operators follow the mathematical meaning of XOR, so using the > "exactly one true value" definition for ^^ and xor would make Perl 6 > inconsistent with itself.
You're aware that Perl was designed by a linguist, with an eye toward incorporating natural language concepts, right? As for the bitwise xor: I consider the "inconsistency" between it and the logical xor to be a feature, not a bug. Mind you, it's a feature that needs to be made apparent; but it's a feature nonetheless. Specifically, it gives you a simple way of choosing which semantics you wish to use: '^' gives you the natural language semantics, while '?^' gives you the mathematical semantics. This gives the programmer an easy way of choosing which semantics he wants to use. > I was going to say more in support of adding a separate operator for > "exactly one true value," but Darren Duncan beat me to it. Well, we already have "one" to mean "exactly one true value". -- Jonathan "Dataweaver" Lang