On Sat, 12 Oct 2002, Chris Dutton wrote: : On Saturday, October 12, 2002, at 01:10 PM, Luke Palmer wrote: : : >> Date: Sat, 12 Oct 2002 08:43:46 -0700 (PDT) : >> From: Larry Wall <[EMAIL PROTECTED]> : >> : >> If we use | and & as sugar for any() and all(), then their precedence : >> should probably be the same as || and &&. : > : > Should they? I had in mind something just above comparisons. That : > way: : > : > if $x == 3 || $y == 4 {...} : > : > and : > : > if $x == 1 | 2 { ... } : > : > both DWIM. Is there a case for not doing this? : : Just a thought, but don't we already have this with the "smart match" : operator? : : if $x =~ (1, 2) { ... }
Yes, =~ implies an any() around a list. But | could leave out the parens, presuming the precedence is higher than =~. : Or would & and | be a bit more strict in use, and thus easier for the : compiler to optimize? For instance, would we be able to: : : if $x == 1 | "hello" { ... } : : or would both operands have to be of the same type? I don't see why they'd have to be the same type. There could well be good reasons for superposing objects of different types. Larry