At 11:42 AM +0300 8/16/06, Markus Laire wrote:
On 8/16/06, Darren Duncan <[EMAIL PROTECTED]> wrote:
The difference between === and eqv is that, if you have 2 symbols, $a
and $b, and $a === $b returns true, then that result is guaranteed to
be eternal if you don't assign to either symbol afterwards.
So do you mean that this code
$a = "One";
$b = "One";
$aa := $a;
say "Same before" if $a === $b;
$aa = "Two";
say "Same after" if $a === $b;
would print
Same before
Same after
because here I have "2 symbols, $a and $b, and $a === $b returns true"
and I don't assign to either symbol afterwards - and you seem to be
saying that only with mutable types like Array can you change the
contents via another symbol ($aa here).
Thanks for catching that typo.
What you are saying with your above example is correct, and I knew
about that before, but it slipped my mind when I wrote my explanation
before.
I'll try saying what I meant differently here:
The difference between === and eqv is that, if you have 2 symbols, $a
and $b, and $a === $b returns true, then that result is guaranteed to
be eternal if you don't assign to either symbol [or other symbols
aliased to either] afterwards.
The idea is that, the degree to which === examines 2 variables to
consider them equal or not is only so far as they are immutable. So
if you say "$foo = $bar", and then "$baz === $foo" returns true, then
a subsequent assignment to or type-allowed mutation of $bar won't
invalidate that $baz === $foo, but an assignment to $foo would.
-- Darren Duncan