Leopold Toetsch wrote:
Klaas-Jan Stol wrote:
I don't quite see the problem that is suggested in parrotobject.pmc:
void* invoke(void* next) {
SELF.init();
return next;
}
This is more a relict from the Pie-thon hack. But removing it doesn't
really help currently. The invoke tries to call "__invoke" then but
fails in Parrot_runops_fromc_args, because it can't create a signature
for the "void *next" argument in the call.
A couple of things I don't understand:
1. When I invoke an object, its invoke handler is called, right? Isn't
this invoke handler by default just empty? It's the task of the PMC
implementor (or when writing a class in PIR, then the class writer -- me
in this case) to implement this invoke handler (so I can implement the
behaviour I want)
2. what should "void *invoke(void *next)" in ParrotObject.pmc do then?
(what should be its function?) (this is more or less a the same question
as 1.)
3. What's this "next" argument?
4. And, last but not least, what do you mean by this:
" because it can't create a signature for the "void *next" argument
in the call. "
You probably want to pass some arguments to your invoke handler but
that's not implemented.
what kind of arguments would you like to be able to pass to the invoke
handler?
Or, do you perhaps mean that when doing this:
$P0 = new "Foo"
$P0(arg1, arg2, arg3)
then, the object (represented by ParrotObject.pmc) 's __invoke is
called, and it should be possible to pass arguments arg1, arg2, and arg3
to the __invoke handler?
If so, then the above mentioned invoke function could be implemented
like this:
void *invoke(void *next, ...) {
va_list args;
struct parrot_regs_t *bp;
va_start(args, next);
// I'm not sure what should happen now ??
va_end(args);
// what should be returned ??
}
... I think
mmm, I'm sorry I don't really understand, but I'm not very familiar with
the inner workings of how this should work :-(
Maybe you can come up with a reasonable inplementation for it.
I'd like to try, but as pointed out above, I don't really understand
some key points (yet...)
klaas-jan