Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • While clever, I think you've harmed readability rather than helped it by hiding the return in the block. As a reader, I want the flow control statements to be as explicit and obvious as possible so I don't miss them. That's the reason why PBP makes an exception for them in end-of-line conditionals and loops.

    • by masak (6289) on 2008.12.21 10:45 (#66570) Homepage Journal

      I can certainly understand that objection. Readability is important, and inventing new control flow "builtins" is a risky business.

      However, it's also possible to reason the other way: I expect any conscientious reader to familiarize themselves with all the local variables in my sub before trying to understand what it does. &flunk_move is one of those local variables; and it happens to be a code block controlling the program flow. Making use of PBP's rule for putting control flow on the left, serves to make this fact even clearer.

      I suspect this is a pattern that, by its nature, won't please everybody. Some people will think that the ability to define control flow closures will be worth the slight hit to readability, some won't. TIMTOWTDI.