>>>>> "DC" == Damian Conway <[EMAIL PROTECTED]> writes:

>> 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.

DC> I would claim that the failure mode is not obvious: "dog"=="cat" is true????

Sure it is. I pass a large amount of data and _everything_ matches! Voila,
I messed up the test. Test looks okay. (If I was a newbie, '==' is broken.
Given my experience, I used the wrong test.)

DC> I often need a generic comparison test (typically for equality of less-than),
DC> and to get it one has to jump through hoops:

DC>     sub generic_eq {
DC>             my $failed;
DC>             local SIG{__WARN__} = { $failed = 1 };
DC>             return $_[0] eq $_[1] || $_[0]==$_[1] && !$failed;
DC>     }

DC> I want generic equality to DWIM. I.e. are these the same (for some
DC> reasonable value of "same").

DC> And "dog"=="cat" is not a reasonable value of "same".

Agreed. But ... one of the side effects of the '==' comparison is that
it coerces the two sides into being numbers. This has effects (not nice
ones) on future usages of the value. (Think '&' and '|'.)

Are you proposing that usage of numeric comparisons _will not_ change
the 'type' of the arguments?

(This should be an internals issue, but in perl5 it is a user visible
effect. RFC anyone?)

<chaim>
-- 
Chaim Frenkel                                        Nonlinear Knowledge, Inc.
[EMAIL PROTECTED]                                               +1-718-236-0183

Reply via email to