Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Any, Code] move signatures out of headlines
eventually I want to link to methods in a class like doc.perl6.org/type/Code#signature so it makes sense to have only the method name as a heading
  • Loading branch information
moritz committed Jul 2, 2012
1 parent 7988a7c commit 0ba2375
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/Any.pod
Expand Up @@ -10,7 +10,9 @@ most built-in classes.
=head2 Methods
=head3 ACCEPTS(Any:D: Mu $other)
=head3 ACCEPTS
multi method ACCEPTS(Any:D: Mu $other)
Returns C<True> if C<$other === self> (ie it checks object identity).
Expand Down
20 changes: 15 additions & 5 deletions lib/Code.pod
Expand Up @@ -12,14 +12,18 @@ from blocks, subroutines or methods) will be of some subclass of C<Code>.
=head2 Methods
=head3 ACCEPTS(Code:D: Mu $topic)
=head3 ACCEPTS
multi method ACCEPTS(Code:D: Mu $topic)
Usually calls the code object and passes C<$topic> as an argument.
However, when called on a code object that takes no arguments, the code
object is invoked with no arguments and C<$topic> is dropped. The
result of the call is returned.
=head3 arity(Code:D:) returns Int:D
=head3 arity
method arity(Code:D:) returns Int:D
Returns the minimum number of positional arguments that must be passed
in order to call the code object. Any optional or slurpy parameters in the
Expand All @@ -32,7 +36,9 @@ code object's C<Signature> do not contribute, nor do named parameters.
say &args.arity; # 1
say &slurpy.arity; # 2
=head3 count(Code:D:) returns Real:D
=head3 count
method count(Code:D:) returns Real:D
Returns the maximum number of positional arguments that may be passed
when calling the code object. For code objects that can accept any
Expand All @@ -46,12 +52,16 @@ C<count> will return C<Inf>. Named parameters do not contribute.
say &args.count; # 2
say &slurpy.count; # Inf
=head3 signature(Code:D:) returns Signature:D
=head3 signature
multi method signature(Code:D:) returns Signature:D
Returns the C<Signature> object for this code object, which describes
its parameters.
=head3 Str(Code:D:) returns Str:D
=head3 Str
multi method Str(Code:D:) returns Str:D
Returns the name of the code object.
Expand Down

0 comments on commit 0ba2375

Please sign in to comment.