Skip to content

Commit 2b7bed6

Browse files
committed
doc FALLBACK
1 parent 7b9e2ea commit 2b7bed6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/Language/typesystem.pod6

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@ TODO
2626
2727
=head3 Methods
2828
29+
=head4 Fallback method
30+
X<|FALLBACK (method)>
31+
32+
A method with the special name C<FALLBACK> will be called when other means to
33+
resolve the name produce no result. The first agument holds the name and all
34+
following arguments are forwarded from the original call. Multi methods and
35+
subsignatures are supported.
36+
37+
class Magic {
38+
method FALLBACK ($name, |c(Int, Str)) {
39+
put "$name called with parameters {c.perl}" }
40+
};
41+
Magic.new.simsalabim(42, "answer");
42+
43+
# OUTPUT: «simsalabim called with parameters ⌈\(42, "answer")⌋␤»
44+
2945
=head4 Reserved Method Names
3046
3147
X<|WHAT (reserved method)>X<|WHO (reserved method)>X<|HOW (reserved method)>X<|VAR (reserved method)>

0 commit comments

Comments
 (0)