routine dynamic
| 1 | class Hash | 
| 1.1 | (Hash) routine dynamic | 
| 2 | class Scalar | 
| 2.1 | (Scalar) method dynamic | 
| 3 | class Array | 
| 3.1 | (Array) routine dynamic | 
Documentation for routine dynamic assembled from the following types:
class Hash
From Hash
(Hash) routine dynamic
Defined as:
method dynamic(--> Bool)
Returns True if the invocant has been declared with the is dynamic trait.
my ;say .dynamic; # OUTPUT: «False»my is dynamic;say .dynamic; # OUTPUT: «True»
If you declare a variable with the * twigil is dynamic is implied.
my ;say .dynamic; # OUTPUT: «True»
Note that in the Scalar case you have to use the VAR method in order to get correct information.
my is dynamic = %('apples' => 5);say .dynamic; # OUTPUT: «False» (wrong, don't do this)say .VAR.dynamic; # OUTPUT: «True» (correct approach)
class Scalar
From Scalar
(Scalar) method dynamic
method dynamic(Scalar: --> Bool)
Returns whether the variable is visible in dynamic variable lookups.
Example:
my = 42;say .VAR.dynamic; # OUTPUT: «True»
class Array
From Array
(Array) routine dynamic
Defined as:
method dynamic(Array: --> Bool)
Returns True if the invocant has been declared with the is dynamic trait.
my ;say .dynamic; # OUTPUT: «False»my is dynamic;say .dynamic; # OUTPUT: «True»
If you declare a variable with the * twigil is dynamic is implied.
my ;say .dynamic; # OUTPUT: «True»
Note that in the Scalar case you have to use the VAR method in order to get correct information.
my is dynamic = [1, 2, 3];say .dynamic; # OUTPUT: «False» (wrong, don't do this)say .VAR.dynamic; # OUTPUT: «True» (correct approach)