Skip to content

Commit a493998

Browse files
committed
$. method call syntax shorthand works with meta-methods refs #2632
1 parent 587622d commit a493998

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/Language/operators.pod6

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,17 @@ metaclass. It desugars to C<$invocant.HOW.method($invocant, ...)>. See
805805
L<the metaobject protocol documentation|/language/mop> for more information.
806806
807807
Technically, not a real operator; it's syntax special-cased in the compiler.
808+
It can be also applied, within classes, to access metamethods on self:
809+
810+
=for code
811+
class Foo {
812+
has $.a = 3;
813+
method bar {
814+
return $.^name
815+
}
816+
};
817+
say Foo.new.bar; # OUTPUT: «Foo␤»
818+
808819
809820
X«|methodop .?»
810821
=head2 methodop C«.?»

0 commit comments

Comments
 (0)