On Thu, Aug 04, 2016 at 09:54:54PM +0100, Zefram wrote: > Patrick R. Michaud wrote: > >So are you looking for...? > > No. I want a writable reference that I can pass around as a value, > store in a data structure, and so on. The Scalar object obtained by > "$a.VAR" is clearly the thing to pass around as a value; I'm looking > for the way to write through it.
"writable reference" --> "Scalar" "store in a data structure" --> "bind using :=" I think that using := is the canonical way to do these sorts of operations: > my $a = 123; 123 > my $b := $a; $b = 5; say $a; 5 > my @c; @c[2] := $a; $a = 5; say @c[2]; 5 > my %d; %d<abc> := $a; $a = 'abc'; say %d<abc>; abc > say "$a $b @c[2] %d<abc>"; abc abc abc abc > $a = 4; say "$a $b @c[2] %d<abc>" 4 4 4 4 More generally -- when I last checked Perl 6 doesn't really have "references" in the same style as Perl 5 -- i.e., objects that can be passed around and are magically transparent when you need them to be and opaque when you don't. So far I think we've been able to use binding to do all of the things that Perl 5 references allowed (but more cleanly and efficiently). Pm