* David Golden <dagolden@cpan.org> [2012-08-25T13:14:10] > On Sat, Aug 25, 2012 at 9:22 AM, Ricardo Signes > <perl.p5p@rjbs.manxome.org>wrote: > > > Again: I really think the test-writer (that is, the programmer chosing the > > matching (not matched) operand) needs to be in control of the behavior of > > the > > test. > > > > Maybe we're thinking about smartmatch all wrong. It's really more akin to > the binding operator "=~" than it is to the comparison operators "==" and > "eq". Yes. That's how I've always thought about it: it's =~ but moreso. :) > That led me to an additional thought about why defaulting to string > comparison in the ambiguous case makes sense: > [...] > Thus, without an explicit cast, treating $lhs ~~ $scalar as $lhs eq $scalar > is non-lossy, whereas numeric comparison could be. I'm still fine with the > ambiguous case *warning*, but I think it should do something useful rather > than return undef and I think the string case is the most natural one to > use. Good, because I have favored that working-with-warning behavior for ambiguous simple scalars. (What about `$x ~~ $glob`? That's where I liked undef-and-warn.) -- rjbsThread Previous | Thread Next