Jump to content

Talk:C3 linearization

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by KGyST (talk | contribs) at 06:46, 20 May 2023 (Misleading inheritance orders between the languages). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

WikiProject iconComputer science Start‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
Things you can help WikiProject Computer science with:

WikiProject iconComputing: Software Start‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Software (assessed as Low-importance).

Diamond problem?

Is this at all related to the diamond problem? Is it a solution to the diamond problem? Fresheneesz (talk) 04:29, 8 February 2012 (UTC)[reply]

Clarification of "head" and "tails" of list

It might help to clarify what the definition of the "head" and the "tail" of a list is? For example, on the surface, I might assume that, given a list [A, B, C, D, E] that the head is [A] and the tail is [E]. If this is the case, following the rule"...is done by selecting the first head of the lists, which does not appear in the tail of any of the lists.", the example for the C3 linearization of Z would be

  • Step 1: [Z] merge(L(K1), L(K2), L(K3), [K1, K2, K3])
  • Step 2: [Z] merge([K1,A,B,C,O], [K1,D,B,E,O], [K3,D,A,O], [K1, K2, K3])//all prior linearizations expanded
  • Step 3: [Z, K1] merge([A,B,C,O], [K1,D,B,E,O], [K3,D,A,O], [K2,K3])

Here is where the definition of "head" and "tail" for the lists becomes confusing. If the head is the first element, and tail is the last element, then A should be the next item, however the example shows that K1 is selected next. It would seem that the head is the first element, and the tail is any element that is not the first element? Chrislk02 Chris Kreider 20:43, 29 April 2015 (UTC)[reply]

Naming of K3 and K2

Without any exception, K3 appears before K2 everywhere. I think it would make to swap those name consistently, so that what now is called K3 will be called K2 and vice versa. That won't change the fundamental meaning of the article, but will make the order more logical, and therefore decrease the mental burden in understanding the examples. --2003:C3:CF2E:9516:4982:BFB4:A87D:30B4 (talk) 22:53, 17 March 2022 (UTC)[reply]

Mistake in computation

The computation example produces the following result

= [Z, K1, C, K3, K2, B, A, D, E, O] // done

which disagrees with the result quoted for Python code:

>>> Z.mro() 
[Z, K1, C, K3, A, K2, B, D, E, O, <class 'object'>]

The latter is the truthful output of Python code (I checked), so the former must be wrong and should be corrected. AVM2019 (talk) 17:50, 31 December 2022 (UTC)[reply]

Different inheritance orders between languages: why?

Is there a reason that in the Java-like example the inheritance order of K1 is C, B, A

 class O
 class K1 extends C, B, A

whereas in the Python 3 example the inheritance order of K1 is C, A, B

class K1(C, A, B): pass

At first glance this is quite misleading.

KGyST (talk) 06:46, 20 May 2023 (UTC)[reply]