Skip to content

Commit

Permalink
Adds examples for anon refs #1655
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed May 31, 2019
1 parent ffca8b2 commit 15ce9aa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/Language/variables.pod6
Expand Up @@ -621,6 +621,18 @@ but still aren't installed in a scope:
say %operations<square>.name; # square
say %operations<square>(8); # 64
Since it is a declarator, it can be applied anywhere anything is declared, for
instance for classes or even sigilless variables.
say anon class þ {}; # OUTPUT: «(þ)␤»
say anon sub þ { 42 }; # OUTPUT: «&þ␤»
Since these symbols are not installed in the scope, they can't be used by name.
They are useful, however, if they need to be assigned to an external variable
and they need to know their name themselves.
=head2 The C<state> declarator
C<state> declares lexically scoped variables, just like C<my>. However,
Expand Down

0 comments on commit 15ce9aa

Please sign in to comment.