raku is a well behaved language in that concepts are kept "orthogonal" where possible. So from the docs there are three concepts in play:
  1. the sigil - @ (or $, %, &)- provides guidance on the content of your attribute container - in the case of @ it does role Positional
  2. the twigil - . or ! - provides guidance on the encapsulation, a "public attribute" with '.' has a getter accessor method automatically generated - with 'is rw' both getter and setter methods are provided
  3. the actual contents - in this case an Array - and each item in an Array is a scalar container that may be assigned a value
You are experiencing the implications of this design in a number of ways:
1 class Fish { 2 has @!scales; 3 4 multi method scales { @!scales } 5 multi method scales( @new ) { @!scales = @new } 6 method raku { "[ scales => {@!scales} ]" } 7 } 8 9 my $fish = Fish.new; 10 $fish.scales: ('green','blue','yellow'); 11 12 dd $fish;

In reply to Re: [raku] what accessors are actually autogenerated for @.array attributes? by p6steve
in thread [raku] what accessors are actually autogenerated for @.array attributes? by tomgracey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.