-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smart match is matching unexpectedly #12164
Comments
From @dmcbrideCreated by @dmcbride$ perl5.16.0 -E 'say "what?" if "a" ~~ 0' perlop says: Object Any invoke ~~ overloading on Object, Any Num numeric equality I think the "Any Num" match should actually be: nummy[4] Num numeric equality I know there is reluctance to play with smart matching in general, Ideally "nummy" would be defined as: Either an actual number, or a string that looks like one, B<or an object But that's probably asking a bit too much. Perl Info
|
From zefram@fysh.orgDarin McBride wrote:
That's as documented. By using a number on the RHS, you've asked for
No, it's deliberately avoiding unwanted complexity. It's consistent with -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @dmcbrideOn Sunday June 10 2012 5:38:01 AM you wrote:
I know it's as documented. I even provided said documentation. But it's
"general principle" Object Any invoke ~~ overloading on Object, Nope. Num nummy[4] numeric equality Nope. undef Any check whether undefined Nope. In the "Other" section, there are 3 of 5 entries that rely on the LHS of ~~ to So, if we had a new section: nummy: Left Right Description and pseudocodenummy1[4] nummy2[4] numeric equality then we are still having the RHS "determine the type of comparsion" - at least I'm simply having a hard time imagining anyone *wanting* "a" ~~ 0 to match. As a side effect, it would clean up a surprise warning when attempting this |
From @ap* Darin McBride <dmcbride@cpan.org> [2012-06-10 16:15]:
Maybe it’s easier if you realise that C<< '1 banana' ~~ 1 >> would also |
From @dmcbrideOn Sunday June 10 2012 7:35:35 PM you wrote:
Ok, I have to admit, that seems odd, too. Then again, I run under full So I tried under common::sense instead, didn't get the warning, and so I see I'm not sure if this is an argument in favour or against the change. But, |
Migrated from rt.perl.org#113568 (status was 'open')
Searchable as RT113568$
The text was updated successfully, but these errors were encountered: