Raku / old-issue-tracker

Tickets from RT
https://github.com/Raku/old-issue-tracker/issues
2 stars 1 forks source link

Capture.perl doesn't show arg mutability #5588

Open p6rt opened 8 years ago

p6rt commented 8 years ago

Migrated from rt.perl.org#128978 (status was 'open')

Searchable as RT128978$

p6rt commented 8 years ago

From zefram@fysh.org

my $a = 3; my $c = \($a); $c.perl \(3)

The fact that the argument in the Capture is mutable is a rather important aspect of the Capture, and the .perl isn't representing it. It's showing code for a quite different Capture of an immutable argument. This is less than awesome. Obviously .perl can't be expected to preserve the specific identity of the mutable argument, but it could at least preserve the fact that it's mutable, by emitting something like `\(my $ = 3)` in place of `\(3)`.

-zefram

p6rt commented 8 years ago

From @dwarring

Same can also be said of other containers, including lists and pairs​:

my $l = (10, my $ = 20); $l[1]++; say $l.perl;
$(10, 21) my $p = (10 => my $ = 20); $p.value++; say $p.perl; 10 => 21

These also don't attempt to show mutability.

On Wed Aug 17 15​:54​:05 2016, zefram@​fysh.org wrote​:

my $a = 3; my $c = \($a); $c.perl \(3)

The fact that the argument in the Capture is mutable is a rather important aspect of the Capture, and the .perl isn't representing it. It's showing code for a quite different Capture of an immutable argument. This is less than awesome. Obviously .perl can't be expected to preserve the specific identity of the mutable argument, but it could at least preserve the fact that it's mutable, by emitting something like `\(my $ = 3)` in place of `\(3)`.

-zefram

p6rt commented 8 years ago

The RT System itself - Status changed from 'new' to 'open'