@@ -637,19 +637,39 @@ Technically, not a real operator; it's syntax special-cased in the compiler.
637
637
X « |postfix .+ »
638
638
= head2 postfix C « .+ »
639
639
640
- C < $invocant.+method > calls all methods called C < method > from C < $invocant > ,
641
- and returns a L < List > of the results. Dies if no such method was found.
640
+ C < $foo.+meth > walks the MRO and calls all the methods called C < meth > and submethods called C < meth > if the type is the same as type of C < $foo > .
641
+ Those methods might be multies, in which case the matching candidate
642
+ would be called.
642
643
643
- Technically, not a real operator; it's syntax special-cased in the compiler.
644
+ After that, a L < List > of the results are returned. If no such method was found,
645
+ it throws a L < X::Method::NotFound > exception.
646
+
647
+ class A {
648
+ method foo { say "from A"; }
649
+ }
650
+ class B is A {
651
+ multi method foo { say "from B"; }
652
+ multi method foo(Str) { say "from B (Str)"; }
653
+ }
654
+ class C is B is A {
655
+ multi method foo { say "from C"; }
656
+ multi method foo(Str) { say "from C (Str)"; }
657
+ }
658
+
659
+ say C.+foo; # OUTPUT: «from Cfrom Bfrom A(True True True)»
644
660
645
661
X « |postfix .* »
646
662
= head2 postfix C « .* »
647
663
648
- C < $invocant.*method > calls all methods called C < method > from C < $invocant > ,
649
- and returns a L < List > of the results. If no such method was found, an empty
650
- L < List > is returned .
664
+ C < $foo.*meth > walks the MRO and calls all the methods called C < meth > and submethods called C < meth > if the type is the same as type of C < $foo > .
665
+ Those methods might be multies, in which case the matching candidate
666
+ would be called .
651
667
652
- Technically, not a real operator; it's syntax special-cased in the compiler.
668
+ After that, a L < List > of the results are returned. If no such method was found,
669
+ an empty L < List > is returned.
670
+
671
+ Technically, postfix C < .+ > calls C < .* > at first. Read postfix C < .+ > section to
672
+ see examples.
653
673
654
674
X < |postfix ». > X « |postfix >>. »
655
675
= head2 postfix C < ». > / postfix C « >>. »
0 commit comments