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.
I'd leave that to language lawyers. Undef (like null in SQL) could be interpreted to mean "I don't know", and a case could be made that "I don't know" xor'ed with anything is "I don't know".
Furthmore, the concept of a logical xor seems to be a Perl innovation. Languages like C and Python don't have such a concept.
Finally, Perl doesn't seem to be consistent. Anything xor undef always seems to return the leftmost argument.
*shrug*
Unfortunately, this does not work as inheritance seems to take precedence over defaults.
Partly. Specific functions are set last.
The precedence seems to be specific functions, inheritance, and then defaults.
... 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.
The passed in mmd init list only has specific and defaults.
Finally, I took a look at Parrot_mmd_register_parents.
Don't ;-)
Oops. ;-)
... 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.
OK, I'll leave this alone unless I have a specific problem that I need to fix. Hopefully by then, all this will go away.
- Sam Ruby