File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -611,6 +611,33 @@ returns C<(Mu)>.
611
611
my Int %h2 = 'oranges' => 7; # (values must be of type Int)
612
612
say %h2.of; # OUTPUT: «(Int)»
613
613
614
+ = head2 routine dynamic
615
+
616
+ Defined as:
617
+
618
+ method dynamic(--> Bool:D)
619
+
620
+ Returns C < True > if the invocant has been declared with the L < is dynamic|/routine/is dynamic >
621
+ trait.
622
+
623
+ my %a;
624
+ say %a.dynamic; # OUTPUT: «False»
625
+
626
+ my %b is dynamic;
627
+ say %b.dynamic; # OUTPUT: «True»
628
+
629
+ If you declare a variable with the C < * > twigil C < is dynamic > is implied.
630
+
631
+ my %*b;
632
+ say %*b.dynamic; # OUTPUT: «True»
633
+
634
+ Note that in the L < Scalar > case you have to use the C < VAR > method in
635
+ order to get correct information.
636
+
637
+ my $s is dynamic = %('apples' => 5);
638
+ say $s.dynamic; # OUTPUT: «False» (wrong, don't do this)
639
+ say $s.VAR.dynamic; # OUTPUT: «True» (correct approach)
640
+
614
641
= head1 Subscript Adverbs
615
642
616
643
Some methods are implemented as adverbs on subscripts.
You can’t perform that action at this time.
0 commit comments