John M. Dlugosz wrote: > Perl 6 doesn't have references anymore, it has captures. So, what > does the following mean: > > @x = <foo bar>; > $a = [1, 2, \@x]; > > I imagine that the 3rd element of the Array is itself an Array, and is > the same object that is bound to @x. But captures are lazy > context-sensitive beasts, so I wonder if there is more poised to go on > than I want or care about in this example. > > say $a[2] === @x; #gives True > @x[1] = "baz"; > say $a[2][1]; #gives baz Captures themselves are immutable, but the underlying data that they reference is not. Thus the laziness, or at least that's what I understand it to mean. I'm sure I read something along these lines in a synopsis, probably S02. JonathanThread Previous