> This seems to be adding a special case. (I.e. only if _both_ are
> non-numeric will it switch to a cmp operation.)
Well, I'd prefer it to always switch, but I thought that might be argued
against. Since, *this* is being argued against, maybe I'll extend my proposal
:-)
> I currently fail to switch to 'eq' many times when I should, but the
> failure mode is obvious. Her the failure mode will be really strange.
I would claim that the failure mode is not obvious: "dog"=="cat" is true????
I often need a generic comparison test (typically for equality of less-than),
and to get it one has to jump through hoops:
sub generic_eq {
my $failed;
local SIG{__WARN__} = { $failed = 1 };
return $_[0] eq $_[1] || $_[0]==$_[1] && !$failed;
}
I want generic equality to DWIM. I.e. are these the same (for some
reasonable value of "same").
And "dog"=="cat" is not a reasonable value of "same".
Damian
- RFC 54 (v1) Operators: Polymorphic comparisons Perl6 RFC Librarian
- Re: RFC 54 (v1) Operators: Polymorphic comparison... Jean-Louis Leroy
- Re: RFC 54 (v1) Operators: Polymorphic comparison... Chaim Frenkel
- Re: RFC 54 (v1) Operators: Polymorphic comparison... Peter Scott
- Re: RFC 54 (v1) Operators: Polymorphic comparison... Damian Conway
- Re: RFC 54 (v1) Operators: Polymorphic compar... John Porter
- Re: RFC 54 (v1) Operators: Polymorphic comparison... Damian Conway
- Re: RFC 54 (v1) Operators: Polymorphic compar... Glenn Linderman
- Re: RFC 54 (v1) Operators: Polymorphic compar... Chaim Frenkel
- Re: RFC 54 (v1) Operators: Polymorphic co... Dan Sugalski
- Re: RFC 54 (v1) Operators: Polymorphi... Clayton Scott
- Re: RFC 54 (v1) Operators: Polym... David L. Nicol
- Re: RFC 54 (v1) Operators: Polym... Damian Conway
- Re: RFC 54 (v1) Operators: Polymorphic comparison... Hildo Biersma
- Re: RFC 54 (v1) Operators: Polymorphic comparison... Michael Fowler
