[Chicago-talk] Perl Style

Steven Lembark lembark at wrkhors.com
Thu Aug 19 16:18:24 CDT 2004



-- "Randal L. Schwartz" <merlyn at stonehenge.com>

>>>>>> "Steven" == Steven Lembark <lembark at wrkhors.com> writes:
>
> Steven> The trick of snuggling everything comes from publishers,
> Steven> who don't want the extra page space used for curlys, etc.
>
> Uh, no.  I do it because I don't want to spend a lot of time needlessly
> scrolling up and down past lines that don't add any value.
>
>     if (XXXXX) { # <<== clearly the beginning of the if
>       foo; # <<== clearly the body
>       bar; # <<== more body
>     } # <<== clearly the end
>
>     if (XXXX) { # <<== beginnng
>       foo; # <<== "if true"
>     } else { # <<== clearly the switch from if-true to if-false
>       bar; # <<== "if false"
>     } # <<== now we're done
>
> I don't see what adding an extra line in there to put the open curly
> on a separate line buys you.  Except a wasted line when you're trying
> to scroll up and down to see your code.  Each one of those lines has a
> logical distinct purpose.  Nothing is wasted.  Unnestled curlies
> add an extra line:
>
>     if (XXX) # <<== beginning an if
>     {        # <<== but we already knew that... !
>       ...

     if (XXXXX) { # <<== clearly the beginning of the if
       foo; # <<== clearly the body
       bar; # <<== more body
     } # <<== clearly the end

     if (XXXX) { # <<== beginnng
       foo; # <<== "if true"
     } else   # <<== clearly the switch from if-true to if-false
       bar; # <<== "if false"
     } # <<== now we're done

Also simplified block indent via '%' in vi.

-- 
Steven Lembark                           9 Music Square South, Box 344
Workhorse Computing                                Nashville, TN 37203
lembark at wrkhors.com                                     1 888 359 3508


More information about the Chicago-talk mailing list