develooper Front page | perl.perl5.porters | Postings from February 2012

Stealing stackable modifiers from Perl 6

Thread Next
Aristotle Pagaltzis
February 6, 2012 02:11
Stealing stackable modifiers from Perl 6
Message ID:
Hello porters,

if memory serves, it has always been the case that Perl 5 could easily
allow arbitrarily stacked statement modifiers, but Larry consciously
chose to forbid this, with an eye toward the readability of code.

For Perl 6, he has recanted very slightly.

Arbitrary stacking is still forbidden in Perl 6, but two modifiers can
be stacked as long as one is a conditional (if, unless, when) and the
other a loop (while, until, for/-each).

I like this solution a lot. It covers all of the cases in which I’ve
ever had a reasonable (to me!) hankering for stackable modifiers, while
preventing almost all the abuse caught by the stricter, older rule.

Would it be hard to steal this for Perl 5? Would it cause any problems?

Aristotle Pagaltzis // <>

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About