Stephen Simmons (via RT) wrote:
> I've attached a file, junctions.p6, which illustrates that binary junctions
> treat "undef" as true, and not as false.  My interpretation is that if you
> have:
> if JUNCTION { THEN }
> 
> the JUNCTION simplifies down to a simple logical operation, as in Perl 5
> (Though ^ doesn't mean quite the same thing with more than two operands).

Yes, that's my interpretation as well.

>  Test cases 34-37 were an attempt to use them in other contexts, and it
> seems that in an equality context, they work fine (or at least better).
> 
> Thus 1|undef is evaluated as true, as is 1&undef; but 0|undef is also
> evaluated as true.  On the other hand, 1^undef is true which contradicts the
> theory, but 0^undef is true as well.
> 
> The output of the attached perl script is shown below.

Thanks for the tests, I'll rewrite them in terms of Test.pm, and add
them to the test suite.

Tests 34 to 36 were a bit overcritical:

(0|undef && say "not ok 34") || say "not ok 34";
(0&undef && say "not ok 35") || say "not ok 35";
(0^undef && say "not ok 36") || say "not ok 36";

but are easily corrected. The rest seem fine to me.

Cheers,
Moritz

-- 
Moritz Lenz
http://moritz.faui2k3.org/ |  http://perl-6.de/

Reply via email to