C3 linearization

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computing, the C3 superclass linearization is an algorithm used primarily to obtain the order in which methods should be inherited (the "linearization") in the presence of multiple inheritance, 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 fitting the monotonicity criterion. (The name "C3" is not an initialism.) It was first published at the 1996 OOPSLA conference, in a paper entitled "A Monotonic Superclass Linearization for Dylan".[1] It was adapted to the Open Dylan implementation in January 2012 [2] following an enhancement proposal.[3] Subsequently, it has been chosen as the default algorithm for method resolution in Python 2.3 (and newer),[4][5] Perl 6,[6] and Parrot.[7] It is also available as an alternative, non-default MRO in the core of Perl 5 starting with version 5.10.0.[8] An extension implementation for earlier versions of Perl 5 named Class::C3 exists on CPAN.[9]


  1. ^ "A Monotonic Superclass Linearization for Dylan". OOPSLA '96 Conference Proceedings. ACM Press. 1996-06-28. pp. 69–82. doi:10.1145/236337.236343. ISBN 0-89791-788-X. 
  2. ^ News item on opendylan.org
  3. ^ Dylan Enhancement Proposal 3: C3 superclass linearization
  4. ^ Python 2.3's use of C3 MRO
  5. ^ Tutorial for practical applications of C3 linearization using Python
  6. ^ Perl 6 will use C3 MRO
  7. ^ Parrot uses C3 MRO
  8. ^ C3 MRO available in Perl 5.10 and newer
  9. ^ Perl 5 extension for C3 MRO on CPAN