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

Re: scalar dereferencing.

Thread Previous | Thread Next
From:
Rod Adams
Date:
June 17, 2005 12:29
Subject:
Re: scalar dereferencing.
Message ID:
42B32484.3040005@rodadams.net
Larry Wall wrote:

>On Fri, Jun 17, 2005 at 03:56:50AM +0800, Autrijus Tang wrote:
>: 
>:     my $x = 3;
>:     my $y = \$x;
>:     say $y + 10;
>:     $y++;
>:     say $y;
>:     say $x;
>: 
>: Currently in Pugs they print:
>: 
>:     13
>:     4
>:     3
>: 
>: Is this sane?  What is the scalar reference's semantics in face of a
>: stringification and numification?  I assume that array/hash references
>: simply pass on to the things they references to resolve stringify
>: and numify, according to S02, but I had not been able to find mentioning
>: about scalar refs
>
>I suspect people will find that counterintuitive.  A more consistent
>approach might produce
>
>    13
>    14
>    14
>  
>
Don't you mean:

    13
    4
    4

?

-- Rod Adams


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