Em Sex, 2009-09-25 às 18:28 +0200, Moritz Lenz escreveu:
> class A { method m { say 'OH HAI' } };
> my $m = A.new.^methods(:local).[0];
> How should I invoke $m?
> In current Rakudo this works:
> $m(A.new);    # supply the invocant as first argument
> But shouldn't be just $m() (invocant magically curried) or may
> $m(A.new:) (invocant not curried, but marked with a colon)?

Methods are only methods when they are dispatched as methods, otherwise
they are regular subs. The invocant in the capture is just the first
positional argument, so $m(A.new) is what you want, although $m(A.new: )
should have the same effect.

daniel



Reply via email to