develooper Front page | perl.perl5.porters | Postings from August 2008

Re: [PATCH] Precedence nit in Test::Builder

Thread Previous | Thread Next
From:
Vincent Pit
Date:
August 29, 2008 10:06
Subject:
Re: [PATCH] Precedence nit in Test::Builder
Message ID:
48B82C6D.4030505@profvince.com

>> -    $self->_whoa(!$self->{Have_Plan} and $self->{Curr_Test},
>> +    $self->_whoa(!$self->{Have_Plan} && $self->{Curr_Test},
>>           'Somehow your tests ran without a plan!');
>>     
>
>
> Really?  My research indicates that the comma is lower than either
> form of and, in both scalar and array contexts:
>
> $ perl -le 'print ( @x=(!0 and 2,3))'
> 23
>
> $ perl -le 'print ( @x=(!0 && 2,3))'
> 23
>
> $ perl -le 'print ( $x=(!0 && 2,3))'
> 3
>
> $ perl -le 'print ( $x=(!0 and 2,3))'
> 3
>   
You two first examples shows that it's higher. Also, when in doubt, I
ask Deparse, and it told me :

$ perl -MO=Deparse,-p -e '!$x and $y, "foo"'
((not $x) and ($y, '???'));


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About