@@ -12,14 +12,18 @@ from blocks, subroutines or methods) will be of some subclass of C<Code>.
12
12
13
13
= head2 Methods
14
14
15
- = head3 ACCEPTS(Code:D: Mu $topic)
15
+ = head3 ACCEPTS
16
+
17
+ multi method ACCEPTS(Code:D: Mu $topic)
16
18
17
19
Usually calls the code object and passes C < $topic > as an argument.
18
20
However, when called on a code object that takes no arguments, the code
19
21
object is invoked with no arguments and C < $topic > is dropped. The
20
22
result of the call is returned.
21
23
22
- = head3 arity(Code:D:) returns Int:D
24
+ = head3 arity
25
+
26
+ method arity(Code:D:) returns Int:D
23
27
24
28
Returns the minimum number of positional arguments that must be passed
25
29
in order to call the code object. Any optional or slurpy parameters in the
@@ -32,7 +36,9 @@ code object's C<Signature> do not contribute, nor do named parameters.
32
36
say &args.arity; # 1
33
37
say &slurpy.arity; # 2
34
38
35
- = head3 count(Code:D:) returns Real:D
39
+ = head3 count
40
+
41
+ method count(Code:D:) returns Real:D
36
42
37
43
Returns the maximum number of positional arguments that may be passed
38
44
when calling the code object. For code objects that can accept any
@@ -46,12 +52,16 @@ C<count> will return C<Inf>. Named parameters do not contribute.
46
52
say &args.count; # 2
47
53
say &slurpy.count; # Inf
48
54
49
- = head3 signature(Code:D:) returns Signature:D
55
+ = head3 signature
56
+
57
+ multi method signature(Code:D:) returns Signature:D
50
58
51
59
Returns the C < Signature > object for this code object, which describes
52
60
its parameters.
53
61
54
- = head3 Str(Code:D:) returns Str:D
62
+ = head3 Str
63
+
64
+ multi method Str(Code:D:) returns Str:D
55
65
56
66
Returns the name of the code object.
57
67
0 commit comments