Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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

by Jenda (Abbot)
on Aug 20, 2007 at 14:57 UTC ( #633842=note: print w/replies, xml ) Need Help??

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

  • I don't think nested modifiers are a good idea. The result would be too complex and hard to read. If you need two "levels", change the outer one to an ordinary loop or conditional statement.
  • I don't do thinks like this, but it might be handy. It wil make parsing harder again though so I doubt it will be implemented.
  • That looks like a neat idea.
  • Comment on Re: what would you like to see in perl5.12?

Replies are listed 'Best First'.
Re^2: what would you like to see in perl5.12?
by Porculus (Hermit) on Aug 20, 2007 at 23:41 UTC

    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...

      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://633842]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2017-11-21 18:58 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (309 votes). Check out past polls.