Sam Ruby <[EMAIL PROTECTED]> wrote:
Concrete example: should ResizablePMCArray inherit sort from FixedPMCArray?
Yes. But the inheritance should be (and is AFAIK already partially) in the method lookup. But it's not quite finished. Objects derived from PMCs inherit methods of the parent, but one level only. PMC inheritance isn't followed yet IIRC.
I'm puzzled as to what works and what doesn't work. I added a __add__ method to pyobject and I can't access it from pyint... however I can access sort from ResizablePMCArray. Weird.
I'm assuming the answer is yes, as classes defined via the subclass opcode seem to inherit non-vtable methods. In fact, I've made a number of assumptions, any of which could invalidate the attached patch.
I'll look through it. But we'll very likely not do the static inheritance by duplicating NCI method slots. That would prevent to override a base class method.
I did make it so that methods declared on one PMC would override methods declared in any parent... perhaps you are talking about methods defined at runtime in the bytecode?
If you can sketch out what you would find to be an acceptable approach, I'll take a look at implementing it. Meanwhile, I'll see if I can isolate a test case.
- Sam Ruby