Changes between Version 1 and Version 2 of C3 linearization
- Timestamp:
- 02/10/10 07:36:35 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
C3 linearization
v1 v2 17 17 == C3 Avoidance == 18 18 19 In most cases, C3 can be avoided. If a class has no parent ('''very''' infrequent) or if a class has only one parent (very common - this is single inheritance) then the MRO computation is trivial. The MRO of a root class is a list of the class itself. The MRO of a class with one parent is the parent's MRO with the child class added.19 In most cases, C3 can be avoided. (See source:/trunk/src/pmc/class.pmc#L430) If a class has no parent ('''very''' infrequent) or if a class has only one parent (very common - this is single inheritance) then the MRO computation is trivial. The MRO of a root class is a list of the class itself. The MRO of a class with one parent is the parent's MRO with the child class added. 20 20 21 21 {{{ … … 46 46 === C3_merge === 47 47 48 `C3_merge` identifies a valid candidate class, searching in a particular order. The ''first'' valid candidate is considered the "next" entry in the MRO. All references to that candidate are removed from the search arena, and the function calls itself recursively.48 `C3_merge` (see source:/trunk/src/oo.c#L1109) identifies a valid candidate class, searching in a particular order. The ''first'' valid candidate is considered the "next" entry in the MRO. All references to that candidate are removed from the search arena, and the function calls itself recursively. 49 49 50 50 ==== Find a candidate class ====