Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Little annoying mistakes ... of others

by SuicideJunkie (Priest)
on Dec 07, 2008 at 15:36 UTC ( #728729=note: print w/ replies, xml ) Need Help??


in reply to Re: Little annoying mistakes ... of others
in thread Little annoying mistakes ... of others

To contrast, what annoys me, is people putting curlies at the end of a line where they are hard to find, and even harder to match up with their close curly.

I have no idea why saving one line could be worth reducing readability like that, even on an 800x600 screen like my laptop. :)


Comment on Re^2: Little annoying mistakes ... of others
Re^3: Little annoying mistakes ... of others
by Jenda (Abbot) on Dec 07, 2008 at 23:47 UTC

    Why do you need to find them? There's a while, for, eval, if, sub or something like that at the start of the line and the following ones are indented.

      Many times there is. But blocks do not always have control structures. And there are often times when you need to break the control up into multiple lines for readability.
      If you ever want to comment out those lines or even the whole block, it is much nicer to have the open curly on its own line.

        If the block does not have a statement it belongs to then of course the opening curly will be the first and only thing on a line. Which is yet another reason not to put the ones that do belong to a statement on the beginning of a line. I'd rather know whether something is the body of a loop or other control structure or a bare block introduced to limit the scope of some variables. And if I ever need to comment out the whole block, I'll need to comment out the statement as well.

        As for statements broken into multiple lines ... you may use different level of identation. Say two spaces for multiline statements and four for blocks. I do not find the need, I do not write that many multiline statements, those I do usually do not start with statements that have a block, and if they do I'll indent them somewhat line this:

        while (some very very complex condition ) { ... ... }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://728729]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2014-09-17 22:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (100 votes), past polls