Skip to content

Commit

Permalink
[oo] Add some documentation about C3 and MRO as per kid51++'s suggest…
Browse files Browse the repository at this point in the history
…ion for RT #46101.

git-svn-id: https://svn.parrot.org/parrot/trunk@40162 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
Whiteknight committed Jul 20, 2009
1 parent 5c6c97d commit 3121cd5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/oo.c
Expand Up @@ -1250,7 +1250,12 @@ C3_merge(PARROT_INTERP, ARGIN(PMC *merge_list))
=item C<PMC* Parrot_ComputeMRO_C3(PARROT_INTERP, PMC *_class)>
Computes the C3 linearization for the given class.
Computes the C3 linearization for the given class. C3 is an algorithm to
compute the method resolution order (MRO) of a class that is inheriting
from multiple parent classes (multiple inheritance). C3 was first described
by Barrett et al at:
F<http://192.220.96.201/dylan/linearization-oopsla96.html>
=cut
Expand Down
11 changes: 7 additions & 4 deletions src/pmc/class.pmc
Expand Up @@ -46,8 +46,8 @@ An empty ResizablePMCArray PMC is allocated during initialization.

=item C<all_parents>

A cached array of ourself and all parent classes, in MRO order.
A ResizablePMCArray PMC is allocated during initialization,
A cached array of ourself and all parent classes, in method resolution
order (MRO). A ResizablePMCArray PMC is allocated during initialization,
and is populated with the current class.

=item C<roles>
Expand Down Expand Up @@ -403,8 +403,11 @@ make_class_name(PARROT_INTERP, PMC *SELF)
return _class->name;
}

/* calculates the C3 method resolution order for this class --
* working hard *not* to recalculate MRO when unnecessary */
/* calculates the C3 method resolution order for this class. C3 is the
* name of an algorithm used to calculate the method resolution order
* (MRO) to use in a system with multiple inheritance. For more information
* see the documentation associated with C<Parrot_ComputeMRO_C3>.
*/
static PMC *
calculate_mro(PARROT_INTERP, PMC *SELF, INTVAL num_parents)
{
Expand Down

0 comments on commit 3121cd5

Please sign in to comment.