develooper Front page | perl.perl6.language | Postings from March 2005

Re: Junctions - feedback and desires

Thread Previous | Thread Next
From:
Rod Adams
Date:
March 11, 2005 03:15
Subject:
Re: Junctions - feedback and desires
Message ID:
42317DB1.2030001@rodadams.net
Leopold Toetsch wrote:

>Rod Adams <rod@rodadams.net> wrote:
>
>  
>
>>Well
>>    if 10 < $j < 1 { ... }
>>    if 10 < $j { if $j < 1 { ... }}
>>    
>>
>>Could easily wind up with the same opcodes.
>>    
>>
>
>No. In the first case $j is evaluated just once. In the second case it's
>evaluated twice.
>  
>
You're right. I just dived through the archives and found that chained 
operators are an exception. Sorry for missing that.

Which can be a mess explaining to someone how

    if 0 < $x  &&  $x < 10 {...}

can be true when

    if 0 < $x < 10 {...}

is false.

Though I suppose if we can extend this to a general rule of  "if it only 
appears once, it can only be threaded once", it makes a certain amount 
of sense.

-- Rod Adams

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