File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -417,9 +417,27 @@ introduce an alias into the symbol table.
417
417
418
418
= head2 The C < has > Declarator
419
419
420
+ C < has > scopes attributes to instances of a class or role, and methods to
421
+ classes or roles. C < has > is implied for methods, so C < has method x() {} >
422
+ and C < method x() {} > do the same thing.
423
+
424
+ See L < object orientation|/language/objects > for more documentation and some
425
+ examples.
426
+
420
427
= head2 The C < anon > Declarator
421
428
422
- = comment TODO
429
+ The C < anon > declarator prevents a symbol from getting installed in the lexical
430
+ scope, the method table and everywhere else.
431
+
432
+ For example you can use it to declare subroutines which know their own name,
433
+ but still aren't installed in a scope:
434
+
435
+ my %operations =
436
+ half => anon sub half($x) { $x / 2 },
437
+ square => anon sub square($x) { $x * $x },
438
+ ;
439
+ say %operations<square>.name; # square
440
+ say %operations<square>(8); # 64
423
441
424
442
= head2 The C < state > Declarator
425
443
You can’t perform that action at this time.
0 commit comments