Skip to content

Commit

Permalink
Fixing anchors, refs #2146 and #561
Browse files Browse the repository at this point in the history
  • Loading branch information
JJ committed Aug 13, 2018
1 parent 3859d61 commit b203297
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
33 changes: 17 additions & 16 deletions doc/Type/Parameter.pod6
Expand Up @@ -44,28 +44,29 @@ if the parameter is anonymous.
This "sigil" is actually an introspection used to help determine
the normal binding style of a parameter, if it has not been altered
through a L<trait|/type/Signature#Parameter_Traits_and_Modifiers>.
through a L<trait|/type/Signature#Parameter_traits_and_modifiers>.
=begin table
Will bind to Default behavior
= ====================== ================================================================
C<$> Scalar Generate new Scalar, use instead of Scalar in argument, if any
C<@> Positional Bind directly to the argument
C<@> PositionalBindFailover If binding failed, call argument's .cache method, bind to result
C<%> Associative Bind directly to the argument
C<&> Callable Bind directly to the argument
C<|> (anything) Bind to all remaining arguments, make new Capture if needed
C<\> (anything) Bind directly to the argument, keep existing Scalar, if any
Sigil | Will bind to | Default behavior
===================================================
$ | Scalar | Generate new Scalar, use instead of Scalar in argument, if any
@ | Positional | Bind directly to the argument
@ | PositionalBindFailover | If binding failed, call argument's .cache method, bind to result
% | Associative | Bind directly to the argument
& | Callable | Bind directly to the argument
\ | (anything) | Bind directly to the argument, keep existing Scalar, if any
=end table
Also, C<|> will bind to all remaining arguments, make new C<Capture> if needed.
=head2 method type
Returns the L<nominal type constraint|/type/Signature#Type_Constraints> of
Returns the L<nominal type constraint|/type/Signature#Type_constraints> of
the parameter.
=head2 method constraints
Returns L<additional constraints|/type/Signature#Type_Constraints> on the
Returns L<additional constraints|/type/Signature#Type_constraints> on the
parameter (usually as an C<all>-Junction).
=head2 method named
Expand All @@ -74,7 +75,7 @@ Defined as:
method named(Parameter:D: --> Bool:D)
Returns C<True> if it's a L<named parameter|/type/Signature#Positional_vs._Named>.
Returns C<True> if it's a L<named parameter|/type/Signature#Positional_vs._named_arguments>.
my Signature $sig = :(Str $x, Bool :$is-named);
say $sig.params[0].named; # OUTPUT: «False␤»
Expand All @@ -87,7 +88,7 @@ Defined as:
method named_names(Parameter:D: --> List:D)
Returns the list of externally usable names/aliases for a
L<named parameter|/type/Signature#Positional_vs._Named>.
L<named parameter|/type/Signature#Positional_vs._named_arguments>.
=head2 method positional
Expand All @@ -96,7 +97,7 @@ Defined as:
method positional(Parameter:D: --> Bool:D)
Returns C<True> if the parameter is
L<positional|/type/Signature#Positional_vs._Named>.
L<positional|/type/Signature#Positional_vs._named_arguments>.
my Signature $sig = :(Str $x, Bool :$is-named);
say $sig.params[0].positional; # OUTPUT: «True␤»
Expand All @@ -109,7 +110,7 @@ Defined as:
method slurpy(Parameter:D: --> Bool:D)
Returns C<True> for
L<slurpy parameters|/type/Signature#Slurpy_(A.K.A._Variadic)_Parameters>.
L<slurpy parameters|/type/Signature#Slurpy_(A.K.A._variadic)_parameters>.
=head2 method twigil
Expand Down
16 changes: 8 additions & 8 deletions doc/Type/Signature.pod6
Expand Up @@ -20,7 +20,7 @@ X<|:()>
Signatures appear inside parentheses after L<subroutine|/type/Sub> and
L<method|/type/Method> names, on blocks after a C<< -> >> or C<< <-> >> arrow,
as the input to L<variable
declarators|/language/variables#Variable_Declarators_and_Scope> like
declarators|/language/variables#Variable_declarators_and_scope> like
L<C<my>|/syntax/my>, or as a separate term starting with a colon.
sub f($x) { }
Expand Down Expand Up @@ -138,7 +138,7 @@ check the signature of a L<Callable>.
$sig = :(Int, Positional); # just a type is also fine (two parameters)
sub baz(Str) { "Got passed a Str" }
Type constraints may also be L<type captures|/type/Signature#Type_Captures>.
Type constraints may also be L<type captures|/type/Signature#Type_captures>.
X<|where clause>
In addition to those I<nominal> types, additional constraints can
Expand Down Expand Up @@ -195,7 +195,7 @@ the C<where>-clause inside the sub-signature.
=head3 Constraining optional arguments
L<Optional arguments|#Optional_and_Mandatory_Parameters> can have constraints,
L<Optional arguments|#Optional_and_mandatory_arguments> can have constraints,
too. Any C<where> clause on any parameter will be executed, even if it's
optional and not provided by the caller. In that case you may have to guard
against undefined values within the C<where> clause.
Expand All @@ -204,7 +204,7 @@ against undefined values within the C<where> clause.
=head3 Constraining slurpy arguments
L<Slurpy arguments|#Slurpy_(A.K.A._Variadic)_Parameters> can not have type
L<Slurpy arguments|#Slurpy_(A.K.A._variadic)_parameters> can not have type
constraints. A C<where>-clause in conjunction with a L<Junction|/type/Junction>
can be used to that effect.
Expand All @@ -216,8 +216,8 @@ can be used to that effect.
=head3 Constraining named arguments
Constraints against L<Named arguments|#Positional_vs._Named> apply to the value
part of the L<colon-pair|/type/Pair>.
Constraints against L<Named arguments|#Positional_vs._named_arguments> apply to
the value part of the L<colon-pair|/type/Pair>.
sub f(Int :$i){};
f :i<forty-two>;
Expand Down Expand Up @@ -746,7 +746,7 @@ notionally) computed anew for each call
=head2 Dynamic variables
L<Dynamic variables|/language/variables#The_*_Twigil> are allowed in signatures
L<Dynamic variables|/language/variables#The_*_twigil> are allowed in signatures
although they don't provide special behaviour because argument binding does
connect two scopes anyway.
Expand Down Expand Up @@ -815,7 +815,7 @@ arguments.
This is often used in C<proto> definitions (like C<proto foo (|) {*}>) to
indicate that the routine's L<C<multi> definitions|multi> can have any L<type
constraints|#Type_Constraints>. See L<proto|/language/functions#proto> for an
constraints|#Type_constraints>. See L<proto|/language/functions#proto> for an
example.
If bound to a variable arguments can be forwarded as a whole using the slip
Expand Down

0 comments on commit b203297

Please sign in to comment.