Michael Lazzaro [mailto:mlazzaro@;cognitivity.com] wrote
> On Friday, November 1, 2002, at 01:38  PM, David Whipp wrote:
> > Presumably, there exist rules for implicit casting when
> > comparing objects of different types. If we have a rule
> 
> My initial assumption is that nothing would change.  Namely, == 
> compares numerically, eq compares strings, and '?' enforces 
> booleanness.  In numeric context, bool evaluates to 1 or 0; in string 
> context, "1" or "0":

Perhaps I was assuming things that I shouldn't. So lets clarify.

In Perl6, we have 3 equality operators: ==, eq and ~~.  The last of
these is a special "smart-match", so it doesn't really count as
an equality operator.

In Perl5, == compares numerically; and eq compares stringically
(if that's a real word ;).

In Perl6, everything is an object. So almost everything is
neither a number nor a string. It probably doesn't make sense
to cast things to strings/ints, just to compare them. We
probably want a standard method: .equals(), that does a
class-specific comparison.

The question is, will we be modifying the definnitions of ==
and eq, so that one will call the .equals method explicity. And
what does the other do? Do we want to define them in terms of
identity vs equality? Then, is identity a class-specific thing
(i.e. a .identical() method); or is it an "address-in-memory"
kind of thing?

Did I miss a previous discussion of this?


Dave.

Reply via email to