Mixin

Issues

  • where is the data?

supported-by:

  • c# (since C# 8.0, by means of default methods of interfaces), but no data?
  • scala Scala has a rich type system and Traits are a part of it which helps implement mixin behaviour.
    • but "Traits are Mixins just with some slightly different properties from a programming language designers point of view like Mixins require Linearization while Traits are flattened and Traits traditionally don’t contain states."
  • #rust Rust makes extensive use of mixins via traits. Traits, like in Scala, allow users to implement behaviours for a defined type. They are also used for generics and dynamic dispatch, which allow for types with same traits to be used interchangeably statically or dynamically at runtime respectively
  • java
    • default methods for interfaces 1
      • (could work if every actor had a weak dictionary or whatever)
  • javascript
// copy the methods
Object.assign(User.prototype, sayHiMixin);

c.Implementation

Resources

References


Children
  1. Linearization

Footnotes

  1. http://hannesdorfmann.com/android/java-mixins/˄


Backlinks