Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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).

Replies are listed 'Best First'.
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 => '', plp_site => '', 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.)

      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.


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

      ++Zed for setting sensible project and team standards.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2023-03-21 08:52 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (59 votes). Check out past polls.