Skip to content

Commit ed4d87e

Browse files
committed
improve free floating methods
1 parent 7f007f5 commit ed4d87e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

doc/Type/Method.pod6

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66
77
class Method is Routine { }
88
9-
A type for methods. To create a method, use the C<method> keyword:
9+
A type for methods. To create a method outside a L<class
10+
definition|/language/typesystem#Methods>, use the declarators C<my> and C<method>:
1011
1112
my $m = method ($invocant: $param) {
1213
say "$invocant: '$param'";
1314
}
1415
"greeting".$m("hello"); # greeting: 'hello'
1516
17+
<a b c>.&(my method (List:D:){dd self; self}).say;
18+
# OUTPUT«("a", "b", "c")␤(a b c)␤»
19+
1620
=end pod

0 commit comments

Comments
 (0)