in reply to To parens or not parens in chained method calls

I agree with you that both styles have advantages. In this case, I disagree with my fellow monks. Perl code should be as clear as possible for the human reader. What is important is consistency. Make your own choice, and then always do it the same way.
Bill
  • Comment on Re: To parens or not parens in chained method calls

Replies are listed 'Best First'.
Re^2: To parens or not parens in chained method calls
by Your Mother (Archbishop) on Feb 16, 2017 at 16:20 UTC

    Completely agree that consistency might be most important and that every dev is free to choose her own style (unless a house style is enforced, etc).

    I argue that omitting parens, and breaking across lines into semantic chunks, does make the code more clear to a human reader; less content is less cognitive load. Athanasius's examples of the same operation in two styles shows this; where the single line idiom is, to a Perl-centric dev, much easier to read. There is less you have to load into your brain and fewer chances to read something wrong. I'm aware the longer version will likely be easier to follow for a non-Perl hacker. Just as a book written with 3rd grade vocabulary will be easier to the average reader or an ESL student. I gravitate away from the LCD because it ultimately saves time and raises my own game. It's more fun too. When I see an idiom in code that I don't know, I am generally more excited to learn it than I am irritated I don't understand it immediately.

      yet you don't write unit tests ... go figure

        I probably write too many unit tests. You have me confused with someone else; which is pretty hard to do since I frequently answer testing related questions here.