[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl6-internals
Subject:    Re: How to super?
From:       Will Coleda <will () coleda ! com>
Date:       2009-10-30 13:27:49
Message-ID: a45468e30910300627r1669d13etac2d316e6ca7f542 () mail ! gmail ! com
[Download RAW message or body]

On Fri, Oct 30, 2009 at 12:54 AM, Will Coleda <will@coleda.com> wrote:
> Ages past, I wrote a subclass of my TclArray (itself a PMC with a
> parent of Hash) to provide [trace] functionality for the array.
>
> I overrode get_pmc_keyed, did some work to make the trace work, and
> then ended with:
>
>  # Delegate to our parent..
>  $P0 = getattribute self, ['TclArray'], 'proxy'

Apparently the trick (pmichaud++) is to change TclArray to Hash. We're
getting the proxy that points to the first PMC (not class) in our
parent chain.

This works for me, as TclArray didn't override the vtable I was
interested in, so I really wanted Hash's implementation of the vtable
anyway.

There should probably be better syntax for this, and one that allows
us to dispatch to non-PMC parents as well.


>  .local pmc result
>  result = $P0[key]
>  .return (result)
>
>
> However, this was disabled for some time, and when I tried to
> re-enable it, I started getting:
>
> No such attribute 'proxy' in class 'TclArray'
>
> Which is not unexpected, as now TclArray is now written in PIR, not C
> (as it was when this was originally written.)
>
> So, how does one dispatch to one's parent's vtable? Looking for
> super|parent under docs, src/ops and src/pmc doesn't show any likely
> candidates.
>
> --
> Will "Coke" Coleda
>



-- 
Will "Coke" Coleda
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic