Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I use K&R style. I find ANSI style plus uncluddled else's eats up far too much room on the screen. My exception is when the conditional runs over one line. In that case I find the extra vertical distance provides some needed clarity.

    if( $foo  eq $bar and
        $this eq $that )

    I flip/flop between cuddled and uncuddled else's. In the end, your choice won't come back to bite you unless you decide to become a religious bigot about it.

    Just don't do this.

    if( $f

    • I may be alone, but if the conditional runs over one line I treat it as a block:
        $foo  eq $bar and
        $this eq $that
      ) {
      I don't know that anyone else does it that way though.
      • To my eyes that's ok. You still have separation between the complex conditional and the code block making them distinct. What I don't like to see is this:
        if( $foo  eq $bar  and
            $this eq $that ) {
            $baz = 42;
        • Woa, nelly. So - I'll just stick with ANSI style, then. You K&R folks can't actually seem to decide on a style.
          • Sure we can (or I can). I don't fool myself into thinking I can apply a single rule to different conditions. K&R style is vertically efficient. ANSI style uses more vertical space to clarify the difference between the conditional and the code block. Apply as needed. If you have a simple conditional, use K&R. If you have a complex conditional, use ANSI.

            If you ignore the pros/cons each style and just apply one to all your code like a cookie-cutter you're losing their benefits in the name of the