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
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Obscure (Score:1)
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.
Re:Obscure (Score:1)
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_moveis 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.
Reply to This
Parent