Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I prefer K&R style because it eats up less vertical scrolling space on my screen. The indentation shows me that I'm inside a block... I don't need a whole line with a single open curly to show me that. But the close curly shows both the de-indentation and the close of the block... it'd be hard to cuddle that without going a bit nuts.
    --
    • Randal L. Schwartz
    • Stonehenge
    • vertical space doesn't bother me (except for the five times, ever, that I've found myself coding on a green-screen [ or orange ] ). Admittedly, I need to get used to seeing it K&R style (get used to the block style of ANSI, and K&R can look a bit messy).

      I'd have much less problem with K&R if so many folks didn't also use a two-space indentation...

      if ( defined($vara) ) {
        if (1 == $varb) {
          if (2 == $varc) {
            &something;
          }
        }
      }

      ... where

      • Regarding that nested if, if, if structure. I know C++ programmers who like to code like that because it makes it easy to dealloc resources in an orderly fashion in case of an error. I don't know if there are other good uses for that idiom, but I really don't like it for a number of reasons.

        Anyway, in Perl it's not very common, at least not in the code I've stumbled upon. There's seldom use for that kind of structure when most stuff is garbage collected or can be made to clean up automatically (like file handles closing the file when they go out of scope).