On Sun, Aug 24, 2008 at 09:22:25PM +0200, Moritz Lenz wrote:
: Moritz Lenz wrote:
: > 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.
: Easier said than done.
: Question to p6l: do && and || autothread? Or do they collapse the
: junction prior to evaluation? (I hope the latter, since I think it's
: more dwimmy).
: Also do prefix:<?> and prefix:<!> collapse the junction?
I think it would be best if all boolean contexts collapse consistently,
and I would consider all of those to be boolean contexts. More
precisely, && and || are boolean on the left, but not on the right.
Interestingly, ?& and ?| collapse both sides because they coerce both
sides to boolean. Either that, or we make neither side collapse,
if someone can come up with a use case for junctional booleans,
though I suspect the same purpose can be served by +& and +| if you're
careful only to feed it 1 or 0. So probably conceptual consistency
is better here.