On Thu, 2005-03-31 at 23:46 -0800, Darren Duncan wrote:

> What I want to be able to do is compare two references to see if they 
> point to the same thing, in this case an object, but in other cases 
> perhaps some other type of thing.

Let's be clear about the difference between P5 and P6 here. In P5, an
object was actually a reference with special magic that indicated that
it was also tied to a package.

In P6, an object is a data-type. It's not a reference, and any member
payload is attached directly to the variable.

So, comparing references to objects isn't all that common in P6, though
it could certainly happen.

Now, back to the concept of identity comparison... I would expect that
you could do this:

        $ref1 ~~ $ref2

The table in S4 doesn't have an entry for "Any ~~ Reference", but my
guess is that that's just an oversight, as it seems to fit into the flow
nicely.

More generally, I see no direct way to tell if two values have the same
storage (the same PMC in Parrot), so you might have to do something
P5ish:

        \$a ~~ \$b


Reply via email to