C3 Algorithm

From Wikipedia, the free encyclopedia

For other uses, see C3.

The C3 Algorithm is an algorithm used primarily to obtain a consistent linearization of an inheritance heirarchy in object-oriented programming. This linearization is used to resolve the order in which methods should be inherited, and is often termed "MRO" for Method Resolution Order. The name C3 refers to the three important properties of the resulting linearization: a consistent extended precedence graph, preservation of local precedence order, and monotonicity. It was first published at the 1996 OOPSLA conference, in a paper entitled "A Monotonic Superclass Linearization for Dylan"[1]. Subsequently, it has been chosen as the default algorithm for method resolution in Python 2.3, Perl 6, and Parrot. An extension implementation for Perl 5 named Class::C3 exists on CPAN.

[edit] References

  1. ^ http://www.webcom.com/haahr/dylan/linearization-oopsla96.html A Monotonic Superclass Linearization for Dylan

[edit] External Links

Python 2.3's use of C3 MRO
Perl6 will use C3 MRO
Parrot uses C3 MRO
Perl 5 extension for C3 MRO on CPAN