Sam Ruby <[EMAIL PROTECTED]> wrote:

> I took a look into this.  Apparently, in Perl5, the result of xor'ing
> undef with anything is undef.  I'm not suggesting that this is either
> right or wrong (it actually was surprising to me),

Yep. It doesn't really follow the definition of xor, nor does it match
the implementation of other types.

> Unfortunately, this does not work as inheritance seems to take
> precedence over defaults.

Partly. Specific functions are set last.

> ... I think that this should be the other way
> around: a subclass should be able to easily override all MMD operations
> for a given method.

The problem is that the passed in mmd init list has no indication, if a
default function is installed or a inherited or a specific one.

> Finally, I took a look at Parrot_mmd_register_parents.

Don't ;-)

> ... This seems more
> complicated than it needs to be,

Well, yes. But I'm not even sure if it's worth the effort to improve it.
The static MMD table doesn't handle dynamic inheritance. While you can
install a function with mmdvtregister, this is just for a pair of types,
which is rather useless for classes that inherit from one of the types.
But which other functions for which types should be registered too?

This is the reason for the proposal of going fully dynamic with MMD too.

> An alternate approach would be for the make process to generate a
> function that registers a given class into a given type slot, and code
> to call each parent in order (top down) to override their slots as required.

I don't think that this would help currently because the mmd_init table
already has (defaulted) and other static inheritance. Dunno.

> - Sam Ruby

leo

Reply via email to