ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Re: scalar dereferencing.
by Joshua Gatcomb other posts by this author
Jun 17 2005 12:29PM messages near this date
Re: scalar dereferencing. | Re: scalar dereferencing.
On 6/17/05, Larry Wall <larry@[...].org>  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;
>  :

>  I suspect people will find that counterintuitive.  A more consistent
>  approach might produce
>  
>      13
>      14
>      14
>  
>  That is, if + deferences automatically, so should ++, such that the
>  "thingie" pointed to by both $x and $y is what gets incremented,
>  not a clone of it.  It should take more work than that to get a COW
>  reference, I suspect.

Ok - but where does the assignment come in?  The only change to $y is
in $y++ so I would think the results should be
13
4
4

>  
>  Larry
>  

Cheers,
Joshua
a.k.a. L~R
Thread:
Autrijus Tang
Larry Wall
Joshua Gatcomb
Rod Adams
Larry Wall

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved