On Tue, Sep 20, 2005 at 21:09:09 +0200, Juerd wrote: > Mark Reed skribis 2005-09-20 14:31 (-0400): > This has so little redundancy that it makes very little sense to want to > avoid repeating that very short encode_entities($item->label).
The fine line is when the midsection is slightly more than that... If refactoring it into a sub will cause Too much indirection, without reducing complexity (you still have to pass in the parameters), but leaving it as is still duplication. If you minimize the parameters then you get a sub that is very unreusable, since it's specific to this block of code. All you are really doing is making the reader look away from the use by introducing one more symbolic replacement. What I wanted to achieve by the new constructs is two things: * share a lexical scope with the caller to minimize indirection * inline the block to it's "caller" to add to readability These are two advantages that the construct has over wrapping the code in a new sub. > (I'd actually prefer something like: Your example is only WRT data composition... I was actually doing conditional side effects. -- () Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418 perl hacker & /\ kung foo master: uhm, no, I think I'll sit this one out..: neeyah!
Description: PGP signature