On Wednesday, December 11, 2002, at 11:16  AM, Luke Palmer wrote:
This brings up something that's been on the tip of my toungue for
awhile.  In many object-oriented languages we have seen that there is
an important difference between "equal" and "same."  Perl already has
two kinds of equal, but IIRC there is nothing to test whether two
variables refer to the same place in memory.  Should there be?
After thinking about it a little more, I'll set myself on the "yes" side. And propose either '===' or ':=:' to do it.

   $obj1 eq $obj2;    # [1] are their stringifications identical?
   $obj1 == $obj2;    # [2] are their numifications identical?
   $obj1 === $obj2;   # [3] are they in fact the same object?
The reason being that you could in fact want to say any of [1], [2], and [3] as separate, useful concepts. So merely overloading '==' or 'eq' would not be sufficient, as it would hide the previous, still useful meanings.

MikeL



Reply via email to