We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fffe595 commit 5b29667Copy full SHA for 5b29667
doc/Type/Signature.pod
@@ -161,6 +161,16 @@ say limit-lines "a \n b \n c", Int; # "a \n b \n c"
161
For explicitly indicating the normal behaviour, C<:_> can be used, but this is
162
unnecessary. C<:(Num:_ $)> is the same as C<:(Num $)>.
163
164
+=head3 X«Constraining signatures of Callables|function reference (constrain)»
165
+
166
+To constrain block and subroutine references based on their signature write
167
+the signature after the argument name.
168
169
+ sub f(&c:(Int, Str)) { say c(10, 'ten') };
170
+ sub g(Int $i, Str $s){ $s ~ $i };
171
+ f(&g);
172
+ # OUTPUT«ten10»
173
174
=head3 X«Constraining Return Types|-->;returns»
175
176
The token C<-->> followed by a type will force a type check on successful
0 commit comments