How to override invoke?
kjstol
parrotcode at gmail.com
Tue Dec 30 09:22:13 UTC 2008
On Mon, Dec 29, 2008 at 11:35 PM, Will Coleda <will at coleda.com> wrote:
> On Mon, Dec 29, 2008 at 5:30 PM, Andrew Whitworth <wknight8111 at gmail.com>
> wrote:
> > The attached code works and does what you would think it should.
> > However, there is one snag:
> >
> > $P0($P0)
> >
> > This is because when you override the invoke vtable method from PIR,
> > you don't have access to the "self" pmc by default. You have to pass
> > it explicitly.
>
> That's a pretty big snag, as it forces me to change every instance
> where a procedure is invoked in my code. (If I'm doing that anyway, I
> don't need a vtable override.)
>
> Thanks for fleshing out this idea, though: I think it reinforces that
> 'self' is not acting as expected for this particular override, and we
> can probably convert this thread into a ticket with a failing test to
> demonstrate it.
If I read this closely, I think you're suggesting that 'self' should be
passed as first argument automatically if 'self' is used in a :vtable sub.
However, I would say that in many cases this would not be needed (or
'wrong'); you wouldn't be able to do normal sub calls, without passing
'self'. Maybe some kind of pseudo syntax ('super' comes to mind, but that
implies an inheritance relationship), if you want to call the sub that
you're overriding.
Maybe I'm completely misunderstanding this, in which case you can safely
ignore this :-)
kjs
>
>
> --
> Will "Coke" Coleda
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.parrot.org/pipermail/parrot-dev/attachments/20081230/cfe78666/attachment.htm
More information about the parrot-dev
mailing list