Re: Why is the method resolution order different from python,common lisp,...?
Lex Spoon <[email protected]> Sat, 4 Jun 2016 11:56:45 -0400
| Newsgroups | gmane.comp.lang.scala |
|---|---|
| Message-ID | <CALM2SnZ46taYZLT=dFkB9iykmptdaAZHO4WheAN3xx0uYJBt1A@mail.gmail.com> |
As a developer, the sweet spot for writing a mixin is for cases where the linearization order doesn't matter. If the order matters, you are likely making things hard to reason about on whoever has to maintain that code next. A case in point is the Ordering trait. It's really handy for developers, and it requires mixins with concrete methods. Another example is a hypothetical Memoizing trait. Such a trait needs a field to work correctly. So you need almost any language feature to be possible to embed in a mixin. As a parting note, while linearization systems seem to be very useful within a broad range of designs, the older style of non-linearized super() calls seem categorically worse. Both C++ and Java (with its default methods) use the older style. In such systems, the developer often ends up with an impossible choice. Linearization is a big step forward, whichever variant of it is used. Lex Spoon -- You received this message because you are subscribed to the Google Groups "scala-language" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.