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

Re: what would you like to see in perl5.12? (nested statement modifiers)

by ysth (Canon)
on Aug 21, 2007 at 06:12 UTC ( #634010=note: print w/ replies, xml ) Need Help??


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

Nested statement modifiers are reportedly rejected by Larry for Perl 6, so presumably ruled out of court for Perl5 as well. Poking around shows this thread about a year ago, with someone citing Larry rejecting them 5 years ago.

If indeed this is final, all I can say is "too bad". I think all the arguments against multiple statement modifiers apply equally to single statement modifiers. And you may call it "enough rope", but rope can be awfully handy at times. If I have time, I may dig up a couple of examples where I would have used them, and people can laugh at me.

Update: another couple of Perl 6 threads, from 2003: Statement modifiers, Statement modifiers (yes, again)


Comment on Re: what would you like to see in perl5.12? (nested statement modifiers)
Re^2: what would you like to see in perl5.12? (nested statement modifiers)
by TimToady (Parson) on Aug 21, 2007 at 17:20 UTC
    Nevertheless, Rule 2 applies here: several months ago we decided it was okay for Perl 6 to allow a conditional modifier inside a loop modifier because it makes it easier to write list comprehensions close to the way mathematicians like to write them:
    %desc{$_} if .path for <n ne e se s sw w nw up down>
    Also, any parenthesized or bracketed expression is now parsed as a statement, so you can nest modifiers to your heart's content as long as you parenthesize. In particular, this allows you to use a list comprehension for a slice subscript.

    Update: changed @desc to %desc as noted by wolverian++

Re^2: what would you like to see in perl5.12? (nested statement modifiers)
by JavaFan (Canon) on Aug 07, 2008 at 14:37 UTC
    Actually, the main reason Perl5 doesn't have nested statement modifiers is that noone submitted a patch for it.

    About the only way to get your wish into Perl5 is to actually go do it. A single person writing a patch for nested modifiers increases the chance to get it added to Perl a million times more than a thousand perlmonks wishing for it in a thread.

      In many cases, I'd agree with you. This, though, is something people seem to have a real hangup over. The patch is pretty trivial (albeit writing tests is less so). But now that Larry has changed his mind, it should be an easier sell. (pause). There, the perly.y changes took about 45 seconds. Anybody want to help write tests?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://634010]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2014-12-18 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (66 votes), past polls