We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7685316 commit 144a3a9Copy full SHA for 144a3a9
doc/Language/variables.pod6
@@ -691,6 +691,14 @@ scope it should be copied to a new variable.
691
foo() for ^3;
692
# OUTPUT«onetwothree»
693
694
+Please note that the implicit state declarator is only applied to the variable
695
+itself, not the expression that may contain an initializator. If the
696
+initializer has to be called exactly once, the C<state> declarator has to be
697
+provided.
698
+
699
+ subset DynInt where $ = ::('Int'); # the initializer will be called for each type check
700
+ subset DynInt where state $ = ::('Int'); # the initializer is called once, this is a proper cache
701
702
=head3 The C<@> Variable
703
704
In a similar manner to the C<$> variable there is also a L<Positional>
0 commit comments