[Chicago-talk] Perl Style

Randal L. Schwartz merlyn at stonehenge.com
Thu Aug 19 13:41:18 CDT 2004

>>>>> "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... !

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

More information about the Chicago-talk mailing list