develooper Front page | perl.perl6.language | Postings from May 2005

Re: Circular dereference?

Thread Previous | Thread Next
From:
Autrijus Tang
Date:
May 4, 2005 08:42
Subject:
Re: Circular dereference?
Message ID:
20050504154133.GA61317@aut.dyndns.org
On Wed, May 04, 2005 at 05:30:48PM +0200, 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.

Note that your explanation is completely different
from the Perl 5 semantics, which my impression was
that the same model is followed by Perl 6.  To wit:

    # Perl 5 code
    my ($x, $y); $x = \$y; $y = \$x; print $$$$$$$$$$$x;

If the reference semantics changed drastically, please
reflect it prominiently in the relevant Synopsis. :)

Thanks,
/Autrijus/


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About