> I made a mistake in my original post, they definitely need to be > left-associative. Your example should obviously be interpreted as: > > (.method given $x) given $y; # calls $x.method
ok. > I think this is similar to how I mentioned that a duplicate 'for' is > pointless. Just because pointless modifier combinations exist > doesn't mean multiple modifiers in general are a problem. Agreed. But is it worth putting them in if they would make a problem so easily, and it can be so easily handled with blocks? > since 'if' has a lower precedence than '=', this is: > ($x = $y) if $z; > or equivalently > $z and ($x = $y) duh. ok. > > print if $x if $y; # ?? > > > >Are you saying "test $y, and if it's true, test $x, and if it's true > >then print"? > > Yes ok, but wouldn't it be clearer to say print if $y and $x; # ? > It means the left side is not always evaluated; that's > short-circuiting and has nothing to do with precedence. > Notice how in perl 5 the 'or' operator is in the lowest > precedence class, but certainly short-circuits (think "foo or die") But that's easier on the brain, becausewe read left-to-right, and it short-circuits left-to-right. "z() if $x if $y" doesn't. > > print "$x,$y\n" for $x -> @x for $y -> @y; # is that approximate? > > Syntax error. The -> operator doesn't make sense without a block. > See http://www.perl.com/pub/a/2002/10/30/topic.html But if() currently takes a block unless it's postfix. I was just extrapolating, though as I said, I'd hate to try and write the parser. > > print for @x for @y; # @y's topic masked > >would probably make no sense unless ... > > Note that I actually *said* it makes no sense. I have to admit that > if the conditionals (if, unless, when) would be operators, I'd have > trouble to think of a situation where multiple modifiers are useful > at all; which I why I said making the conditionals infix-operators > would probably suffice. I was just agreeing there. :) > Then again, I just thought up (perl 5 style): > > print for split while <>; > > but I have to admit I can probably live without the ability to write > something like that ;-) Ditto....but I have *wanted* to do something vaguely like that on *several* occasions! More often it is conditionals, though. I'll leave it to better minds, and use whatever they give me. ;o] __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/