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
Assigning Proxy objects
by Ingo Blechschmidt other posts by this author
Jun 14 2005 5:39AM messages near this date
Re: %hash1 >>...<< %hash2 | Re: Assigning Proxy objects
Hi, 
 
  sub proxy () is rw { 
    return new Proxy: 
      FETCH =>  { 42 }, 
      STORE =>  -> $new { 23 }; 
  } 
 
  say proxy();        # 42 
  say proxy() = 40;   # 40, 23, or 42? 
 
Currently I think the last line should output 40, consider: 
 
  sub innocent_sub ($var is copy) { 
    my $foo = ($var = 40); 
    # Do something with $foo, relying on $foo being 40. 
  } 
 
  { my $x = "does not matter"; innocent_sub $x } 
  # Works 
 
  { my $x := proxy(); innocent_sub $x } 
  # Would break if (proxy() = 40) would not return 40. 
 
But I can argue that the return value of Proxy object should 
be the return value of the code given by FETCH in the Proxy 
object construction, too... 
 
Opinions? 
 
--Ingo 
 
--  
Linux, the choice of a GNU | To understand recursion, you must first 
generation on a dual AMD   | understand recursion.   
Athlon!                    | 
Thread:
Ingo Blechschmidt
Larry Wall

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