I'm interested to know the complete set of alternatives to subtype polymorphism in scala.
The basic tools for of achieving statically-checkable polymorphism in Scala are
Calling all of these 'alternatives' is probably the wrong word, since they are so well integrated. It's not uncommon for some polymorphic algorithms to be expressed by using of several of these tools in conjunction.
It's also worth noting the place of for-comprehensions in Scala polymorphism. For comprehensions don't seem particularly polymorphic. Below the surface, for-comprehensions are just syntactic sugar for calls to filter/map/flatMap, and implementations of those methods tend to be highly polymorphic. Thus, what look to be comparatively simple for-loops can result in some really impressive polymorphic effects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With