<thundergnat> I was idly looking through RT and came across 
http://rt.perl.org/rt3/Public/Bug/Display.html?id=65164 and thought "That looks 
like LHF!"
<thundergnat> I wrote some infix routines that work correctly but the base ^^ 
operator seems 
to be borked.
<thundergnat> rakudo: say 1 ^^ 1;
<p6eval> rakudo : OUTPUT«␤»
<thundergnat> should be Bool::False
<thundergnat> rakudo: say 0 ^^ 0;
<p6eval> rakudo : OUTPUT«0␤»
<thundergnat> also should be Bool::False
<moritz_> what is ^^ ?
<thundergnat> Where is  ^^ implemented? I couldn't find it. 
<moritz_> erm, what's it supposed to be?
<thundergnat> exclusive or
<moritz_> why isn't that ?^ then?
<moritz_> we have ~ ? and + versions of all the logic operators
<moritz_> ^^ feels wrong
<thundergnat> it's in the spec
<Kodi> moritz_: But we say && and ||, not ?& and ?|.
<thundergnat> 
http://github.com/perl6/roast/blob/master/S03-operators/misc.t#L54-L68
<moritz_> Kodi: && and ?& have different semantics
<thundergnat> Maybe the spec needs to be changed.
<Kodi> moritz_: ?& exists? That surprises me.
<moritz_> ie 1 ?& 3 returns True, 1 && 3 returns 3
<Kodi> I see.
<moritz_> rakudo: say 1 ?& 3
<p6eval> rakudo : OUTPUT«Bool::True␤»
<moritz_> infix:<^^>, short-circuit exclusive-or
<moritz_> $a ^^ $b ^^ $c ...
<moritz_> Returns the true argument if there is one (and only one). Returns 
Bool::False if all 
arguments are false or if more than one argument is true.
<moritz_> sounds like it needs to be implemented with list infix associatvity
<thundergnat> Right, Thats what I was doing
<moritz_> src/Perl6/Grammar.pm
<moritz_> 1886:token infix:sym<^^>   { <sym>  <O('%tight_or, :pasttype<xor>')> }
<moritz_> that's wrong
<moritz_> removing the :pasttype<xor> and writing your own two-arg infix:<^^> 
should fix it
* masak , belatedly, submits rakudobug
<masak> ah well, let's integrate it into #65164
<masak> moritz_: wait, two-arg op?
<masak> doesn't the infix:<^^> op have listish behaviour?
<masak> rakudo: our multi sub infix:<^^>(Mu $a, Mu $b) { $a ?? $b ?? 
Bool::False !! $a !! $b ?? 
$b !! Bool::False }; say [^^](1,2,0,3,0); 
<p6eval> rakudo : OUTPUT«3␤»
<masak> that's wrong.
<masak> according to moritz_' quote above.
<thundergnat> masak: good point
<masak> infix:<^^> is *not* two-arg. that's what sets it apart from ?^
<masak> (besides the boolifying thing)

Reply via email to