Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to protect read-onlyness of some container types in attributes (regression) #5168

Open
p6rt opened this issue Mar 10, 2016 · 2 comments

Comments

@p6rt
Copy link

p6rt commented Mar 10, 2016

Migrated from rt.perl.org#127686 (status was 'new')

Searchable as RT127686$

@p6rt
Copy link
Author

p6rt commented Mar 10, 2016

From @skids

Note that star needs to use EnumMap to test this, but the problem happened well after 2015.09.

(09​:58​:41 AM) skids​: star​: class a { has EnumMap $.f = EnumMap.new() }; my $f = a.new(); $f.f.perl.say; $f.f = :a1, :b2; $f.f.perl.say
(09​:58​:41 AM) camelia​: star-m 2015.09​: OUTPUT«EnumMap.new()␤Cannot assign to a readonly variable or a value␤ in block <unit> at /tmp/lpr91G4eaJ​:1␤␤»
(09​:58​:52 AM) skids​: m​: class a { has Map $.f = Map.new() }; my $f = a.new(); $f.f.perl.say; $f.f = :a1, :b2; $f.f.perl.say
(09​:58​:53 AM) camelia​: rakudo-moar f93bab​: OUTPUT«Map.new(())␤Map.new((​:a1,​:b2))␤»

psch++ tracked this to the recent attribute inlining optimizations in rakudo fdd37a9 though there were NQP/MoarVM changes involved in that as well.

Note also this, which is not related and also behaves this way on star​:

10​:05​:11 AM) skids​: m​: my %f := Map.new(); %f = (​:a1, :b2); %f.perl.say
(10​:05​:11 AM) camelia​: rakudo-moar f93bab​: OUTPUT«Map.new((​:a1,​:b2))␤»

This all fell out from a question asked by JRasPass++ here​:

http://irclog.perlgeek.de/perl6/2016-03-09#i_12160443

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

From @zoffixznet

Still present in today's rakudo de5d9e​:

<Zoffix> m​: my $o = class { has $.a = Map.new​: (​:1a) }.new; say $o.a; $o.a = (​:2b); say $o.a
<camelia> rakudo-moar de5d9e​: OUTPUT«Map.new((​:a(1)))␤Map.new((​:b(2)))␤»

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant