Dan Sugalski <[EMAIL PROTECTED]> wrote:

> There are two basic classes of methods here. (And classes of classes,
> something I'm regretting, and I think we'll redo once I get a handle
> on metaclasses and just unify it all)[1]

> The first is the vtable method stuff. There's a static single
> inheritance scheme when Parrot's built.

And a bit of hackish multiple inheritance. OrderedHash isa Array and isa
Hash. It's still static and not really supported by the PMC compiler
albeit needed.

E.g. a TclString isa tclobject (which handles morphing). OTOH it really
should be a String too: almost all worker functions are the same.

A usable scheme for multiple inheritance at the PMC level could vastly
reduce code multiplication and reduce implementation errors.

> The second is the *parrot* method stuff. These generally do a search
> of the hierarchy

And we have a third category: real objects that inherit from PMCs. E.g.
some snippets from the pie-thon tests:

# b3.py
...
T = int

class TT(T):
    def __repr__(self):
        return "T(%d)" % self

class Int(TT):
    ...

    TT.__cmp__ = icmp

The C<int> thingy is a "PyInteger" PMC. C<TT> and C<Int> inherit from
it, e.g. the compare MMD function, which gets overridden in the middle
of the inheritance chain.

Which leads to a nice project called MMD inheritance ...

leo

Reply via email to