develooper Front page | perl.perl6.language | Postings from December 2004

Re: Arglist I/O [Was: Angle quotes and pointy brackets]

From:
Luke Palmer
Date:
December 4, 2004 09:09
Subject:
Re: Arglist I/O [Was: Angle quotes and pointy brackets]
Message ID:
20041204170927.GA10839@navi.cx
Rod Adams writes:
> Okay, this rant is more about the \s<\s than \s=\s. To me, it is easier 
> to understand the grouping of line 1 than line 2 below:
> 
> if( $a<$b && $c<$d ) {...}
> if( $a < $b && $c < $d ) {...}
> 
> In line2, my mind has to stop and ask: is that "($a < $b) && ($c <
> $d)", or "$a < ($b && $c) < $d". It quickly comes to the right answer,
> but the question never comes up in the first line. If I wanted to use
> more parens for clarity, I'd use LISP.

This is Perl.  TMTOWTCI (Clarify It).  

    if ($a < $b) && ($c < $d) {...}
    if $a < $b and $c < $d    {...}
    if $a < $b  &&  $c < $d   {...}

In particular, you need to ask yourself which you'd rather have:

    $a<$b     with   %h«key»
    $a < $b   with   %h<key>

But you might actually have to ask yourself.  I'm still not sure... (and
I'm not even paying attention to the left side).

Luke



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