On Wed, 2005-05-04 at 11:30, Thomas Sandlaß wrote:
> Autrijus Tang wrote:
> > What should this do, if not infinite loop?
> > 
> >     my ($x, $y); $x = \$y; $y = \$x; $x[0] = 1;
> 
> Hmm, after the my both $x and $y store an undef.
> Then $x stores a ref to undef. Then $y stores
> a ref to ref of undef. I see no circle.

Squint harder ;-)

Your mistake was here: "Then $x stores a ref to undef."

It does not. It stores a ref to $y, and I can prove it:

        my($x,$y);
        $x = \$y;
        $y = 7;
        say $$x;
        $y = \$x;
        say $$y; # ?!

If we agree that the first say should print 7, then we must conclude
that either we've changed the value of undef to 7, or we've created a
circular reference.

If we do not agree that the first say prints 7, then we have more
fundamental differences of understanding about how P5 works to figure
out before we can agree on how P6 should work.


-- 
Aaron Sherman <[EMAIL PROTECTED]>
Senior Systems Engineer and Toolsmith
"It's the sound of a satellite saying, 'get me down!'" -Shriekback


Reply via email to