Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^2: what would you like to see in perl5.12?

by Porculus (Hermit)
on Aug 20, 2007 at 23:41 UTC ( #633969=note: print w/replies, xml ) Need Help??

in reply to Re: what would you like to see in perl5.12?
in thread what would you like to see in perl5.12?

Why would nested modifiers be too hard to read? Billions of people around the world manage it on a daily basis, in human languages.

I, for one, am constantly frustrated by the fact that simple, perfectly readable things like

print if /foo/ while <$fh>

don't work. This to me is more intuitive than either of the alternatives, namely

/foo/ and print while <$fh>

which messes up the order of operations, or

while (<$fh>) { print if /foo/ }

which is certainly clear, but just looks cluttered with all that extra punctuation.

Your argument that nested modifiers would be hard to read is weakened by the fact that the "and" version, which is supported today, is by far the least readable of the three. I'm sure I'm not the only average Perl hacker who has to think twice to be certain that the "while" and "and" will be evaluated in the correct order...

Replies are listed 'Best First'.
Re^3: what would you like to see in perl5.12?
by Jenda (Abbot) on Aug 21, 2007 at 08:57 UTC

    Well, do they? Double modifiers remind me of the Monthy Pythons The Meaning of life scene in school

    Now before I begin the lesson will those of you who are playing in the match this afternoon move your clothes down on to the lower peg immediately after lunch before you write your letter home, if you're not getting your hair cut, unless you've got a younger brother who is going out this weekend as the guest of another boy, in which case collect his note before lunch, put it in your letter after you've had your hair cut, and make sure he moves your clothes down onto the lower peg for you. Now...

    The "and" version is certainly supported, but I would not consider it the recomended version.

    There are already people that disapprove the use of statement modifiers completely, I would not go that far, but I'd only recomend using them if both the statement and the modifier is fairly simple.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://633969]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-06-23 03:39 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.