Collections: Difference between revisions

Content added Content deleted
m (→‎P6opaque object (immutable in structure): Make complete, runnable example)
Line 2,329: Line 2,329:


===P6opaque object (immutable in structure)===
===P6opaque object (immutable in structure)===
<lang perl6>my $obj = Something.new: foo => 1, bar => 2;
<lang perl6>class Something { has $.foo; has $.bar };
my $obj = Something.new: foo => 1, bar => 2;
my $newobj = $obj but role { has $.baz = 3 } # anonymous mixin</lang>
my $newobj = $obj but role { has $.baz = 3 } # anonymous mixin</lang>