Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
show difference between implicit and explicit state delcarator
  • Loading branch information
gfldex committed Oct 29, 2016
1 parent 7685316 commit 144a3a9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/Language/variables.pod6
Expand Up @@ -691,6 +691,14 @@ scope it should be copied to a new variable.
foo() for ^3;
# OUTPUT«one␤two␤three␤»
Please note that the implicit state declarator is only applied to the variable
itself, not the expression that may contain an initializator. If the
initializer has to be called exactly once, the C<state> declarator has to be
provided.
subset DynInt where $ = ::('Int'); # the initializer will be called for each type check
subset DynInt where state $ = ::('Int'); # the initializer is called once, this is a proper cache
=head3 The C<@> Variable
In a similar manner to the C<$> variable there is also a L<Positional>
Expand Down

0 comments on commit 144a3a9

Please sign in to comment.