Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Mandatory indenting

by Maclir (Curate)
on Jun 18, 2003 at 12:35 UTC ( #266800=note: print w/ replies, xml ) Need Help??


in reply to Mandatory indenting

To bring this thread back from a Python vs Perl flame-fest, to the original concept "is mandatory code indentation to show structure a good thing, and how can we do this in perl", here is my view:

I indent my code to make it easy for me to see the structure and purpose of the code. How the language compiler / interpreter / parser determines where a code block starts and ends is its own personal business, provided it interprets code structure as I intended it to be.

At the moment, I am coding far more in C and VB.Net than perl. (Yeah, sometimes life sucks.) I probably tend to overuse curly braces, but that way I know there is no confusion - either for the compiler or myself. But I will also break up long lines, particularly for functions calls, and line up parameters.

My bottom line - we doan need no steekin mandatory indentation. It should go the way of column 72 being the line continuation field, and mandatory line numbering in columns 1 to 5 (with column 6 to indicate a comment).


Comment on Re: Mandatory indenting
Re: Re: Mandatory indenting
by Juerd (Abbot) on Jun 19, 2003 at 06:45 UTC

    the original concept "is mandatory code indentation to show structure a good thing, and how can we do this in perl"

    For the record: I think mandatory indenting is a BAD thing, but I liked playing with a source filter to get it in Perl.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

Re: Re: Mandatory indenting
by Zed_Lopez (Chaplain) on Jun 20, 2003 at 19:14 UTC
    I don't like the idea of a language enforcing mandatory indenting, but a common indenting style is a good thing for a team project. That way you can diff two versions of a file and see real differences between them without a zillion irrelevant differences because two programmers have different indenting styles. That's why I configured CVS to reject any code that hasn't been perltidied. It's a little obnoxious, but the effort more than pays for itself. (And cool hack, juerd.)
      ++Zed for setting sensible project and team standards.

      How does your CVS know the code hasnt been tidied and thus to reject? I personally tend to tidy code before I put it under source control, but have no automatic procedure for doing so. Id like to hear more.


      ---
      demerphq

      <Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

        tidy it again and see if it changes :)

        I would suspect it would involve using an entry in the commitinfo administrative file, although I am not sure of the exact format of the entry, or if it would be necessary to involve a script calling PerlTidy, or if it could be done from PerlTidy itself.

        I find the idea intriguing, though, and would be interested in hearing more about it as well.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-07-31 07:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (245 votes), past polls