On Wednesday, December 11, 2002, at 10:36 AM, John Siracusa wrote:
> Maybe "AS_STRING" and "AS_STRING_DEBUG"? Too long? "DEBUG_STRING"? > Are we married to the "AS_*" thing?

Not really -- whatever works. We also had .debug, .identity, and .id proposed, for example.

>> You shouldn't be stringifying objects merely to test if they're the >> same object -- yuck. It was an artifact of Perl5 that we should be >> replacing.)
> So, what is the Perl 6 way to test this?

I was hoping someone would ask that. :-) We don't _have_ a way, AFAIK. It was discussed briefly during the operator thread, but without decision. We know:

$obj1 == $obj2; # compares them numerically
$obj1 eq $obj2; # compares them stringically

We could override either C<==> or C<eq> of C<Object> to do it. Then we have to ask what happens if you say:

$obj == 5;
$obj eq 'foo';

That would hopefully *not* compare the identity of $obj to either 5 or 'foo', but instead Do The Right Thing (numerify or stringify $obj). So presumably, this is a job for multimethod variants of class-specific C<==> or C<eq> operators. Well, sortof.

OR, you just explicitly compare the identities, e.g.

$obj1.identify == $obj2.identity; # yuck

OR, we have a third kind of comparision operator, like perhaps '==='.

$obj1 eq $obj2; # are their stringifications identical?
$obj1 == $obj2; # are their numifications identical?
$obj1 === $obj2; # are they in fact the same object?

The triple '===' being vaguely reminiscent of Unicode '≡'.

MikeL

Reply via email to