> On 9 Jul 2017, at 06:00, Aleks-Daniel Jakimenko-Aleksejev (via RT) 
> <perl6-bugs-follo...@perl.org> wrote:
> 
> # New Ticket Created by  Aleks-Daniel Jakimenko-Aleksejev 
> # Please include the string:  [perl #131722]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=131722 >
> 
> 
> Code:
> my %m := Map.new(<a X b Y>);
> %m<a> = 42;
> say %m.perl
> Result (2015.12~HEAD):
> Map.new((:a(42),:b("Y")))

I would consider this behaviour to be a bug.  Maps are supposed to be immutable.


> Code:
> my %m := Map.new(‘a’, ‘X’, ‘b’, ‘Y’);
> %m<a> = 42;
> say %m.perl
> 
> Result (2015.12 ~ 2016.06):
> Map.new((:a(42),:b("Y")))

This is a bug as well.


> Result (2016.07.1 ~ 2017.05):
> Cannot modify an immutable Str
>  in block <unit> at /tmp/8nf6dnM_9C line 2
> 
> Result (2017.06 ~ HEAD(05c255c)):
> Cannot modify an immutable Str (X)
>  in block <unit> at /tmp/8nf6dnM_9C line 2

This is correct behaviour.


> The significant change happened after 
> https://github.com/rakudo/rakudo/commit/de5d9e70cbfe678d2371d284e9384f53aba1eb94
> 
> I'm not sure what the ideal behavior should be, I'm just pointing out the 
> thing.
> 
> IRC log: https://irclog.perlgeek.de/perl6/2017-07-09#i_14846532
> 
> Another interesting point:
> 
> Code:
> my %m := Map.new(<a X b Y>); say %m.perl
> 
> Result:
> Map.new((:a("X"),:b("Y")))
> 
> 
> Code:
> my %m := Map.new(‘a’, ‘X’, ‘b’, ‘Y’); say %m.perl
> 
> Result:
> Map.new((:a("X"),:b("Y")))
> 
> 
> If their .perl is identical, I guess they should behave identically too.

Indeed, they should.

Reply via email to