Documentation for routine readonly

Documentation for routine readonly, assembled from the following types:

class Attribute

From Attribute

(Attribute) method readonly

Defined as:

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

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

class Library {
    has $.address# Read-only value 
    has 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␤» 

class Parameter

From Parameter

(Parameter) method readonly

Defined as:

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

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