in reply to Re^4: "my $p = value if condition()" as bad|deprecated as "my $p if 0" (Naughty indeed)
in thread "my $p = value if condition()" as bad|deprecated as "my $p if 0" (Naughty indeed)

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        

  • Comment on Re^5: "my $p = value if condition()" as bad|deprecated as "my $p if 0" (maintain)