* Ricardo Signes <perl.p5p@rjbs.manxome.org> [2012-08-25T08:07:40] > > my $reading = Interval->new($raw_data, plus_minus=>$uncertainty); > > > > if ($reading ~~ 0) {...} > > > > # i.e. want Interval's overloading, not a numeric match against > > # $reading object's address > > No, we want the same as C< $reading == 0 >, which can be done with current > overloading. (In fact, which is done in my own Number::Tolerant for just this > means.) Another counterexample, harkening somewhat back to the one of the much earlier examples from Damian. for (@input) { when (0) { warn "can't divide by zero" } say $total / $_; } Seems safe, right? Well, if (similar to David Golden's "Error" example) an element of @input wants to "force" stringwise matching against the zero and its dual-var-ish string representation, even though there is 0+ overloading, then this will explode. (In David's example, it wanted to force numification on itself despite being matched against a string-function-using test; I have only reversed the scenario.) 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. -- rjbsThread Previous | Thread Next