postfix .+

Documentation for postfix .+ assembled from the following types:

language documentation Operators

From Operators

(Operators) postfix .+

$foo.+meth walks the MRO and calls all the methods called meth and submethods called meth if the type is the same as type of $foo. Those methods might be multis, in which case the matching candidate would be called.

After that, a List of the results are returned. If no such method was found, it throws a X::Method::NotFound exception.

class A {
  method foo { say "from A"}
}
class B is A {
  multi method foo { say "from B"}
  multi method foo(Str{ say "from B (Str)"}
}
class C is B is A {
  multi method foo { say "from C"}
  multi method foo(Str{ say "from C (Str)"}
}
 
say C.+foo# OUTPUT: «from C␤from B␤from A␤(True True True)␤»