>> > >I think what Jonathan asked for was an operator for
>> > >returning a method (as an object) which can be invoked
>> > >later with some arguments (or even applied with a
>> > >partial list of arguments for currying).
>> > >
>> > >This would be a lot more useful than a yes-or-no
>> > >answer about the existence of a method.
>
> Exactly. 'Yes' might be valid one moment, and invalid the next. Not a
> very useful operation... Returning a coderef on the other hand is
> useful.

Er.  How could "Is it possible to call this method" become invalid, but
the fptr remains valid?  I'm not sure that I follow that ...

> I don't see it as a problem. In Perl5, you get back a coderef. And
> despite whether the method is modified or removed from the class in the
> meantime, that code reference is still valid.

I think the issue is that Perl is interpreting things, whereas the parrot
would be quoting back actual memory locations saying "ok, this is RIGHT
HERE.  when you want to do it, go RIGHT HERE" and then we up and moved
"here" to "there" and all hell breaks loose when I try to "callmethod" on
a pure number :o

Although, I guess Parrot could still be doing memory management at the VM
level and the PASM would still be getting lookup refs instead of actual
physical pointers, at which case I'm not sure I see the problem ...

I guess if "who's 'foo()' am I calling" is determined by some property of
the object, then it's possible to get a fptr P to function F from object O
at time T, do stuff with O (some of which might cause P' to be the proper
F fptr instead of P), and then calling P is no longer "legitimate" ... But
I'm not entirely convinced that's not the coder's problem, since that
would, imo, be a side-effect of whatever calls were made between "can" and
"call", which means either (a) they're documented properly and the coder
missed that step and forgot to get a new P for F (making P <- P') or (b)
it's NOT documented, at which point it's still the coder's error, just a
different coder :)  since the side-effect is important and (possibly)
break-a-licious ...

--attriel

(so, at the level we're talking about right now, are we getting fptr P as
a memory location that has the function and we want to jump there (or has
the function ref, etc); or is P a ref that parrot will then look up in the
object and dig up the right answer (but has already done some level of
lookup to make this lookup easy; we've already found where it is in the
object the first time; now I have to find out where that is in memory/load
that into memory and call it)



Reply via email to