Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • This should exactly match my implementation on the Parrot side. There is just one test showing init order (which is reverse MRO). Please grep for "constructor - diamond parents" in t/pmc/object-meths.t

    • Leo,

      I have been looking over your MRO test, and I have to say, I think your algoritm might be wrong, or at least not the C3 algorithm we are talking about. I cannot tell for sure until I have seen it tested in destruction order. But my reasoning for this conclusion is as follows.

      Take your reverse MRO (E A D B C F) for this class structure (both extracted from the test you mention):

      A   B A   E
      \ /   \ /
        C     D
         \   /
          \ /

      If we reverse this ordering for our regular MRO we get (F C B D A E). The first problem I see with this is that it violates local precedence order. F followed by C followed by B violates C's local precendence ordering since A comes before B in C's superclass ordering.

      The MRO I get for this particular class tree is (F C D A B E) which as you can see preserves all the local precendence rules involved. The reverse MRO I get is (E B A D C F). To be totally honest, I do not know as much about the reverse MRO as I do the regular MRO, so I cannot comment on this really.

      Also, it seems to me that Parrot (the VM) should not dictate things like MRO, that it should be a language level descision. Surely choosing the native Parrot version will be faster than implementing our own, in the end I don't think it wise to let something so central to a language be dictated by the VM. Of course I am happy to discuss this further, and can help with constructing more tests for Parrot to check the normal MRO order as well.

      • If now implemented C3 MRO (r8650 in trunk). It's of course true that the VM shouldn't dictate a particular MRO, but we have to provide one, so why not that of our major users. If more flexibility is needed, we can always use the current HLL setting and select something different.

        There is one additional test in t/pmc/object-meths.t, showing how to print the MRO of a class.