Skip to content

Commit da20477

Browse files
committed
doc reserved method names
1 parent 5a75e16 commit da20477

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/Language/typesystem.pod

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ TODO
1818
1919
=head3 Methods
2020
21+
=head4 Reserved Method Names
22+
23+
Some build in introspection methods are actually special syntax provided by the
24+
compiler, namely C<WHAT> and C<VAR>. Declaring methods with those names will
25+
silently fail.
26+
27+
class A {
28+
method WHAT { "ain't gonna happen" }
29+
};
30+
31+
say A.new.WHAT; # OUTPUT«(A)␤»
32+
2133
=head4 Setting Attributes with Namesake Variables and Methods
2234
2335
Instead of writing C<< attr => $attr >> or C<:attr($attr)>, you can save some

0 commit comments

Comments
 (0)