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! |