$ raku Welcome to 𝐑𝐚𝐤𝐮𝐝𝐨™ v2021.06. Implementing the 𝐑𝐚𝐤𝐮™ programming language v6.d. Built on MoarVM version 2021.06.
To exit type 'exit' or '^D' > class AA { has Str @.I is rw; }; (AA) > my $CC = AA.new( I => [Str,"abc"] ); AA.new(I => Array[Str].new(Str, "abc")) > say $CC.I; [(Str) abc] > say $CC.I[1]; abc > $CC.I[0] = "zyz"; zyz > say $CC.I; [zyz abc] > On Tue, 6 Jul 2021 at 10:55, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > On creation, I would like to salt some of the > values inside an object when the variable > inside is an array: > > > First a concept test: > $ p6 'class AA { has Str @.I is rw; }; my $CC= AA.new; $CC.I[1] = "def"; > say $CC.I[1];' > > def > > > Now for the pre-salt test > $ p6 'class AA { has Str @.I is rw; }; my $CC = AA.new( I[1] => "abc" ); > say $CC.I[1];' > > ===SORRY!=== Error while compiling -e > Undeclared name: > I used at line 1 > > > What am I doing wrong? > > Many thanks, > -T > > -- > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > If I had a dime every time I didn't know > what was going on, I'd be like, "Why is > everyone giving me all these dimes?" > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale NSW 2351, Australia ngayw...@une.edu.au http://turing.une.edu.au/~ngaywood Phone: +61 (0)2 6773 2412 Mobile: +61 (0)4 7862 0062 Please avoid sending me Word or Power Point attachments. See http://www.gnu.org/philosophy/no-word-attachments.html