method STORE
Documentation for method STORE
assembled from the following types:
language documentation Subscripts
From Subscripts
(Subscripts) method STORE
method STORE (::?CLASS: \values, :)
This method should only be supplied if you want to support this syntax:
my is Foo = 1,2,3;
Which is used for binding your implementation of the Positional
role.
STORE
should accept the values to (re-)initialize the object with. The optional named parameter will contain a True
value when the method is called on the object for the first time. It should return the invocant.
;my is DNA = 'GAATCC';say .Str; # OUTPUT: «((G A A) (T C C))»= 'ACGTCG';say .Str; # OUTPUT: «((A C G) (T C G))»
This code takes into account the value of $initialize
, which is set to True
only if we are assigning a value to a variable declared using the is
syntax for the first time. The STORE
method should set the self
variable and return it in all cases, including when the variable has already been initialized.
language documentation Subscripts
From Subscripts
(Subscripts) method STORE
method STORE (::?CLASS: \values, :)
This method should only be supplied if you want to support the:
my is Foo = a => 42, b => 666;
syntax for binding your implementation of the Associative
role.
Should accept the values to (re-)initialize the object with, which either could consist of Pair
s, or separate key/value pairs. The optional named parameter will contain a True
value when the method is called on the object for the first time. Should return the invocant.
role Positional
From Positional
(Positional) method STORE
method STORE(\values, :)
This method should only be supplied if you want to support the:
my is Foo = 1,2,3;
syntax for binding your implementation of the Positional
role.
Should accept the values to (re-)initialize the object with. The optional named parameter will contain a True
value when the method is called on the object for the first time. Should return the invocant.
role Associative
From Associative
(Associative) method STORE
method STORE(\values, :)
This method should only be supplied if you want to support the:
my is Foo = a => 42, b => 666;
syntax for binding your implementation of the Associative
role.
Should accept the values to (re-)initialize the object with, which either could consist of Pair
s, or separate key/value pairs. The optional named parameter will contain a True
value when the method is called on the object for the first time. Should return the invocant.