[Guido] > > If Samuele agrees that the naive algorithm works better, I'll try > > to make it so in 2.3. [Samuele] > after cooking up the substitution example, I'm quite conviced that > 2.2 mro is the worst of our options: it produces easely > counterintuitive results, and if the conflict notion it needs is the > one I think, it is the most prone to reject hierarchies or in case > we ignore conflict to produce very odd results. I don't disagree. > So IMO our options are: > *) use the naive algo: it is easy to explain (the algorithm) but we > should live with the fact that it is not monotonic and I don't think > it produces the most natural results (because it considers what is > encoutered at the end of a dfs traversal, instead of what is at the > beginning) Sadly, true. > *) adopt C3: > (1) C3 is monotonic (it takes and merges respecting them the mros of > the superclasses, but in parallel, non sequentially like the > current 2.2 mro algo) > (2) it respects also the inheritance lists of all superclasses; the > paper I cited claims that is something intuitively expected, and > I tend to agree. > (3) it has another property, that basically enforces that, when this > does not conflicts with (1) and (2), the dfs order is respected. > How it works: one takes the mros of the direct superclasses and the > inheritance list of the considered class cl, and merges them as > ordered sequences, in case of a tie the mros of the classes > appearing earlier in the inheritance list are favored (this is what > induces (3)) > > The intuitive difference with the current 2.2 mro is that C3 uses > (3) only in case of a tie, while the current 2.2 mro algo tries to > enforce a a mix of (1) and (3) at the same time. > > From the examples this does not seem not to have any evident benefit > (unless we consider the placement of b in ex5 such), and makes it > the most complicated of all algorithms from the point of view of > understanding the outcomes. I'll have to read the paper describing C3: http://www.webcom.com/haahr/dylan/linearization-oopsla96.html but I expect I'll have to agree. Thanks for your help! --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4