readonly
ErrorsCollection

readonly

Synthesised documentation from type/Parameter type/Attribute

From type/Parameter

See Original text in context

method readonly(Parameter:D: --> Bool:D)

Returns True for read-only parameters (the default).

my Signature $sig = :(Str $x is rwBool :$is-named);
say $sig.params[0].readonly;                       # OUTPUT: «False␤» 
say $sig.params[1].readonly;                       # OUTPUT: «True␤»

From type/Attribute

See Original text in context

method readonly(Attribute:D: --> Bool:D)

Returns True for readonly attributes, which is the default, or False for attributes marked as is rw.

class Library {
    has $.address# Read-only value 
    has @.new-books is rw;
}
my $addr = Library.^attributes(:local)[0];
my $new-books = Library.^attributes(:local)[1];
say $addr.readonly;      # OUTPUT: «True␤» 
say $new-books.readonly# OUTPUT: «False␤»