Noticed that you can get conflicts with Method::Also and multi methods. Try this bit:
use Method::Also
class M {
multi method m is also<M> {
self.m(42)
}
multi method m(Int $m) is also<M> {
say "M is $m";
}
}
M.m.say
You'll find that you get the following from the rakudo compiler:
Package 'M' already has a method 'M' (did you mean to declare a multi-method?)
at /home/cbwood/Projects/p6-GtkPlus/scripts/test/test-multi-alias.pl6:9
If in this case, you want all candidates of 'm' to be 'M', there is a solution. Thanks to the fabulous lizmat (the author of the module in question) the best solution is to add a proto method and leave the candidates as they are:
class M {
proto method m(|) is also<M> {*}
multi method m {
self.m(42)
}
multi method m(Int $m) {
say "M is $m";
}
}
You have to admit, that does look a lot nicer!