In Raku, infix operators can be used like functions, e.g.:
1 + 2 ; # 3
infix:<+>(1, 2) ; # 3
[+] 1, 2 ; # 3
Prefix operators can be used with method-like syntax (methodop):
-1 ; # -1
1.:<-> ; # -1
So, (rather academic) question is, can infix operators also be used in method-like way, like 1.:<+>(2)
(which is wrong) ?
(1 + *)(2) ; # 3
… that's function (sort of) definition and call, not a method call, nor method-like syntax.
my method plus(Int $b --> Int){
return self + $b;
}
1.&plus(2) ; # 3
… but +
name cannot be used, also that's not direct operator usage without an additional function definition.
You can use
1.&infix:<+>(2)
1.&[+](2)
1.&(*+*)(2)
1.&{$^a +$^b}(2)