He didn't say that it made it harder/easier to debug. He started to mention "when you go to add". Adding debugging code is just one reason you might need to add code down the road. Having to do a transformation on the format of the code just to add a line means the code requires more work to maintain. I understand that argument and at least partially agree. If you are strongly stressing maximizing how easy the code is to maintain, then I think that added cost is worth considering.

Of course, it isn't a slam-dunk, obvious "win" in the cost/benefit analysis in all cases. I think it is more likely to be noticed if statement modifiers are just one of many "costly" practices and they are rather heavily used.

Of course, chromatic mentions one way that it actually does make it harder to debug. It can also make it harder to add debugging stuff if you need to add a debugging step that should go between two things that you have done in one line.

- tye        


In reply to Re^5: "my $p = value if condition()" as bad|deprecated as "my $p if 0" (maintain) by tye
in thread "my $p = value if condition()" as bad|deprecated as "my $p if 0" (Naughty indeed) by parv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.