On 5/14/07, Mehmet Yavuz Selim Soyturk <[EMAIL PROTECTED] >
wrote:

Should we not be able to use an object that implements 'invoke' as a
method of another object? There is some strange behaviour when I try
to.


I see what you're saying, and it looks like you want a functor.  We can't do
exactly what you want in that syntax, because methods are loosely tied to
objects in Parrot.  Parrot sees 'Func' as a sub, so it wouldn't make any
sense to tell the sub it's called by itself.  Regardless of what
'find_method' returns, the invocant is $P2 when you use PIR syntax.  Here's
how to get the effect you want:

.sub main :main
 $P0 = newclass 'Func'
 $P1 = newclass 'Obj'
 $P2 = new 'Obj'
 $P3 = find_method $P2, 'some_method'
 $P3.$P3()
.end

The patch has been reverted, though, so that won't work until it's fixed and
reapplied.

--
Alek Storm

Reply via email to