Andrew Savige writes:
> --- Matt Fowles <[EMAIL PROTECTED]> wrote:
> > Autrijus~
> > 
> > On Apr 12, 2005 3:50 PM, Autrijus Tang <[EMAIL PROTECTED]> wrote:
> > > * `xor` and `^^` now short-circuits
> > 
> > How does this work?  I thought xor /had/ to evaluate both sides.
> 
> It does. At least according to "Perl 6 and Parrot Essentials" book,
> page 36 it does (I couldn't find details on xor operator in S03).
> I added some xor tests which Autrijus fixed. I'm worried now that
> my tests may be wrong. On page 36 it says: "it returns the value
> of the true operand if any one operand is true".
> 
> # cat f.p6
> my $x = 0 ^^ 42;
> print "x='$x'\n";
> $x = (0 xor 42);
> print "x='$x'\n";
> 
> # pugs f.p6
> x='42'
> x='42'
> 
> Is this correct behaviour? (Pugs used to print not '42' but '1').

Ahh, so it returns the correct value.  It's not short-circuiting
because, for example, in this expression:

    a() xor b()

There is no value that a() (or b()) could return that would supress the
evaluation of the other.

Luke

Reply via email to